/// <summary> /// edit data from view to database /// </summary> /// <param name="_stc"></param> /// <param name="table"></param> /// <returns></returns> public bool Save(ProductionErpEntity.StatorCoilSTCEntity _stc, DataTable table) { Hashtable SQLString = new Hashtable( ); StringBuilder strSql = new StringBuilder( ); edit_stc(SQLString, strSql, _stc); ProductionErpEntity.StatorCoilSTDEntity _std = new ProductionErpEntity.StatorCoilSTDEntity( ); _std.STD001 = _stc.STC001; for (int i = 0; i < table.Rows.Count; i++) { _std.idx = string.IsNullOrEmpty(table.Rows [i] ["idx"].ToString( )) == true ? 0 : Convert.ToInt32(table.Rows [i] ["idx"].ToString( )); _std.STD004 = table.Rows [i] ["STD004"].ToString( ); _std.STD006 = string.IsNullOrEmpty(table.Rows [i] ["STD006"].ToString( )) == true ? 0 : Convert.ToInt32(table.Rows [i] ["STD006"].ToString( )); _std.STD007 = table.Rows [i] ["STD007"].ToString( ); if (string.IsNullOrEmpty(table.Rows [i] ["STD008"].ToString( ))) { _std.STD008 = null; } else { _std.STD008 = Convert.ToDateTime(table.Rows [i] ["STD008"].ToString( )); } _std.STD012 = table.Rows [i] ["STD012"].ToString( ); _std.STD013 = table.Rows [i] ["STD013"].ToString( ); edit_std(SQLString, strSql, _std); } return(SqlHelper.ExecuteSqlTran(SQLString)); }
/// <summary> /// add data to database /// </summary> /// <param name="codeNum"></param> /// <returns></returns> bool Add(string codeNum) { Hashtable SQLString = new Hashtable( ); StringBuilder strSql = new StringBuilder( ); ProductionErpEntity.StatorCoilSTCEntity _stc = new ProductionErpEntity.StatorCoilSTCEntity( ); ProductionErpEntity.StatorCoilSTDEntity _std = new ProductionErpEntity.StatorCoilSTDEntity( ); _stc.STC001 = _std.STD001 = codeNum; string zaS = string.Empty, zS = string.Empty, pfS = string.Empty, psG = string.Empty; DataTable dt = getWinBase(codeNum); if (dt != null && dt.Rows.Count > 0) { _stc.STC002 = string.IsNullOrEmpty(dt.Rows [0] ["WIB010"].ToString( )) == true ? 0 : Convert.ToInt32(dt.Rows [0] ["WIB010"].ToString( )); _stc.STC003 = dt.Rows [0] ["SRT002"].ToString( ); _stc.STC004 = dt.Rows [0] ["WIB003"].ToString( ); zaS = dt.Rows [0] ["WIB004"].ToString( ); zS = dt.Rows [0] ["WIB005"].ToString( ); pfS = dt.Rows [0] ["WIB012"].ToString( ); psG = dt.Rows [0] ["WIB013"].ToString( ); add_stc(SQLString, strSql, _stc); } else { return(false); } _std.STD006 = 0; _std.STD007 = string.Empty; _std.STD008 = null; std_para(SQLString, strSql, _std, zaS, zS, pfS, psG); return(SqlHelper.ExecuteSqlTran(SQLString)); }
void add_stc(Hashtable SQLString, StringBuilder strSql, ProductionErpEntity.StatorCoilSTCEntity _stc) { _stc.STC005 = 0; _stc.STC006 = string.Empty; strSql = new StringBuilder( ); strSql.Append("INSERT INTO MOXSTC ("); strSql.Append("STC001,STC002,STC003,STC004,STC005,STC006) "); strSql.Append("VALUES ("); strSql.Append("@STC001,@STC002,@STC003,@STC004,@STC005,@STC006) "); SqlParameter [] parameter = { new SqlParameter("@STC001", SqlDbType.NVarChar, 50), new SqlParameter("@STC002", SqlDbType.Int, 4), new SqlParameter("@STC003", SqlDbType.NVarChar, 50), new SqlParameter("@STC004", SqlDbType.NVarChar, 50), new SqlParameter("@STC005", SqlDbType.Int, 4), new SqlParameter("@STC006", SqlDbType.NVarChar, 50) }; parameter [0].Value = _stc.STC001; parameter [1].Value = _stc.STC002; parameter [2].Value = _stc.STC003; parameter [3].Value = _stc.STC004; parameter [4].Value = _stc.STC005; parameter [5].Value = _stc.STC006; SQLString.Add(strSql, parameter); }
public FormStatorCoil( ) { InitializeComponent( ); _stc = new ProductionErpEntity.StatorCoilSTCEntity( ); _std = new ProductionErpEntity.StatorCoilSTDEntity( ); _bll = new ProductionErpBll.Bll.StatorCoilBll( ); tableView = new DataTable( ); tablePow = new DataTable( ); Utility.GridViewMoHuSelect.SetFilter(gridView1); Utility.GridViewMoHuSelect.SetFilter(View); FieldInfo fi = typeof(XPaint).GetField("graphics", BindingFlags.Static | BindingFlags.NonPublic); fi.SetValue(null, new DrawXPaint( )); barMenu.LinksPersistInfo.RemoveAt(toolExport.Id); barMenu.LinksPersistInfo.RemoveAt(toolDelete.Id); barMenu.LinksPersistInfo.RemoveAt(toolAdd.Id); wait.Hide( ); controlUnEnable( ); DataTable userTable = _bll.getUserDataTable( ); txtUser.Properties.DataSource = userTable; txtUser.Properties.DisplayMember = "DBA002"; txtUser.Properties.ValueMember = "DBA001"; }
private void backgroundWorker1_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { _bll.getCodeNum(_stc.STC001); tableView = _bll.tableView(_stc.STC001); _stc = _bll.getModel(_stc.STC001); //tablePow = _bll . getDataTablePowForArt ( UserLogin . userNum ,"定子线圈" ); }
protected override int Query( ) { Operation.FormStatorCoilQuery from = new Operation.FormStatorCoilQuery("定子绕圈组装"); if (from.ShowDialog( ) == System.Windows.Forms.DialogResult.OK) { _stc = new ProductionErpEntity.StatorCoilSTCEntity( ); _stc.STC001 = from.getCodeNum; wait.Show( ); backgroundWorker1.RunWorkerAsync( ); } return(base.Query( )); }
void edit_stc(Hashtable SQLString, StringBuilder strSql, ProductionErpEntity.StatorCoilSTCEntity _stc) { strSql = new StringBuilder( ); strSql.Append("UPDATE MOXSTC SET "); strSql.Append("STC005=@STC005,"); strSql.Append("STC006=@STC006,"); strSql.Append("STC007=@STC007,"); strSql.Append("STC008=@STC008 "); strSql.Append("WHERE STC001=@STC001"); SqlParameter [] parameter = { new SqlParameter("@STC001", SqlDbType.NVarChar, 50), new SqlParameter("@STC005", SqlDbType.Int, 4), new SqlParameter("@STC006", SqlDbType.NVarChar, 50), new SqlParameter("@STC007", SqlDbType.NVarChar, 50), new SqlParameter("@STC008", SqlDbType.NVarChar, 50) }; parameter [0].Value = _stc.STC001; parameter [1].Value = _stc.STC005; parameter [2].Value = _stc.STC006; parameter [3].Value = _stc.STC007; parameter [4].Value = _stc.STC008; SQLString.Add(strSql, parameter); }
public ProductionErpEntity.StatorCoilSTCEntity GetModel(DataRow row) { ProductionErpEntity.StatorCoilSTCEntity _model = new ProductionErpEntity.StatorCoilSTCEntity( ); if (row != null) { if (row ["STC001"] != null && row ["STC001"].ToString( ) != string.Empty) { _model.STC001 = row ["STC001"].ToString( ); } else { _model.STC001 = string.Empty; } if (row ["STC002"] != null && row ["STC002"].ToString( ) != string.Empty) { _model.STC002 = int.Parse(row ["STC002"].ToString( )); } else { _model.STC002 = 0; } if (row ["STC003"] != null && row ["STC003"].ToString( ) != string.Empty) { _model.STC003 = row ["STC003"].ToString( ); } else { _model.STC003 = string.Empty; } if (row ["STC004"] != null && row ["STC004"].ToString( ) != string.Empty) { _model.STC004 = row ["STC004"].ToString( ); } else { _model.STC004 = string.Empty; } if (row ["STC005"] != null && row ["STC005"].ToString( ) != string.Empty) { _model.STC005 = int.Parse(row ["STC005"].ToString( )); } else { _model.STC005 = 0; } if (row ["STC006"] != null && row ["STC006"].ToString( ) != string.Empty) { _model.STC006 = row ["STC006"].ToString( ); } else { _model.STC006 = string.Empty; } if (row ["STC007"] != null && row ["STC007"].ToString( ) != string.Empty) { _model.STC007 = row ["STC007"].ToString( ); } else { _model.STC007 = string.Empty; } if (row ["STC008"] != null && row ["STC008"].ToString( ) != string.Empty) { _model.STC008 = row ["STC008"].ToString( ); } else { _model.STC008 = string.Empty; } } return(_model); }
/// <summary> /// edit data from view to database /// </summary> /// <param name="_stc"></param> /// <param name="table"></param> /// <returns></returns> public bool Save(ProductionErpEntity.StatorCoilSTCEntity _stc, DataTable table) { return(_dal.Save(_stc, table)); }