You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
2.6 KiB
C#
46 lines
2.6 KiB
C#
using Mesnac.Action.Base;
|
|
using Mesnac.Codd.Session;
|
|
using Mesnac.Controls.Base;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.ShiftManage
|
|
{
|
|
/// <summary>
|
|
/// 初始化班次管理界面
|
|
/// </summary>
|
|
class InitFormAction : ChemicalWeighingAction, IAction
|
|
{
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
base.RunIni(runtime); //必须要调用的
|
|
ICSharpCode.Core.LoggingService<InitFormAction>.Debug("班次管理-窗体初始化...");
|
|
|
|
DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
|
|
dbHelper.ClearParameter();
|
|
StringBuilder sbSql = new StringBuilder("SELECT * FROM Pmt_Shiftime");
|
|
dbHelper.CommandText = sbSql.ToString();
|
|
dbHelper.CommandType = System.Data.CommandType.Text;
|
|
DataTable table = dbHelper.ToDataTable();
|
|
|
|
List<DbMCControl> mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件
|
|
IBaseControl morningstart = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "morningstart").FirstOrDefault().BaseControl;
|
|
IBaseControl morningend = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "morningend").FirstOrDefault().BaseControl;
|
|
IBaseControl noonstart = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "noonstart").FirstOrDefault().BaseControl;
|
|
IBaseControl noonend = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "noonend").FirstOrDefault().BaseControl;
|
|
IBaseControl nightstart = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "nightstart").FirstOrDefault().BaseControl;
|
|
IBaseControl nightend = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "nightend").FirstOrDefault().BaseControl;
|
|
morningstart.MCValue = DateTime.Parse(table.Rows[0][2].ToString());
|
|
morningend.MCValue = DateTime.Parse(table.Rows[0][3].ToString());
|
|
noonstart.MCValue = DateTime.Parse(table.Rows[1][2].ToString());
|
|
noonend.MCValue = DateTime.Parse(table.Rows[1][3].ToString());
|
|
nightstart.MCValue = DateTime.Parse(table.Rows[2][2].ToString());
|
|
nightend.MCValue = DateTime.Parse(table.Rows[2][3].ToString());
|
|
}
|
|
}
|
|
}
|