/// <summary> /// edit data to database /// </summary> /// <param name="table"></param> /// <returns></returns> public bool Save(DataTable table) { Hashtable SQLString = new Hashtable( ); StringBuilder strSql = new StringBuilder( ); ProductionErpEntity.GeneralAssemblyGEAEntity _gea = new ProductionErpEntity.GeneralAssemblyGEAEntity( ); ProductionErpEntity.GeneralAssemblyGEBEntity _geb = new ProductionErpEntity.GeneralAssemblyGEBEntity( ); for (int i = 0; i < table.Rows.Count; i++) { _geb.GEB001 = table.Rows [i] ["GEB001"].ToString( ); _geb.GEB002 = table.Rows [i] ["GEB002"].ToString( ); _geb.GEB003 = table.Rows [i] ["GEB003"].ToString( ); _geb.GEB004 = table.Rows [i] ["GEB004"].ToString( ); _geb.GEB005 = table.Rows [i] ["GEB005"].ToString( ); if (table.Rows [i] ["GEB007"] == null) { _geb.GEB007 = null; } else { _geb.GEB007 = Convert.ToDateTime(table.Rows [i] ["GEB007"].ToString( )); } _geb.idx = string.IsNullOrEmpty(table.Rows [i] ["idx"].ToString( )) == true ? 0 : Convert.ToInt32(table.Rows [i] ["idx"].ToString( )); if (Exists(_geb.idx)) { edit(SQLString, strSql, _geb); } } return(SqlHelper.ExecuteSqlTran(SQLString)); }
ProductionErpEntity.GeneralAssemblyGEAEntity getModel(DataRow row) { ProductionErpEntity.GeneralAssemblyGEAEntity _model = new ProductionErpEntity.GeneralAssemblyGEAEntity( ); if (row != null) { if (row ["GEA001"] != null && row ["GEA001"].ToString( ) != string.Empty) { _model.GEA001 = row ["GEA001"].ToString( ); } if (row ["GEA002"] != null && row ["GEA002"].ToString( ) != string.Empty) { _model.GEA002 = row ["GEA002"].ToString( ); } if (row ["GEA003"] != null && row ["GEA003"].ToString( ) != string.Empty) { _model.GEA003 = row ["GEA003"].ToString( ); } if (row ["GEA004"] != null && row ["GEA004"].ToString( ) != string.Empty) { _model.GEA004 = row ["GEA004"].ToString( ); } if (row ["GEA005"] != null && row ["GEA005"].ToString( ) != string.Empty) { _model.GEA005 = row ["GEA005"].ToString( ); } } return(_model); }
/// <summary> /// add data to database /// </summary> /// <param name="codeNum"></param> /// <returns></returns> public bool Add(string codeNum) { Hashtable SQLString = new Hashtable( ); StringBuilder strSql = new StringBuilder( ); ProductionErpEntity.GeneralAssemblyGEAEntity _gea = new ProductionErpEntity.GeneralAssemblyGEAEntity( ); ProductionErpEntity.GeneralAssemblyGEBEntity _geb = new ProductionErpEntity.GeneralAssemblyGEBEntity( ); _gea.GEA001 = _geb.GEB001 = codeNum; DataTable table = getWinBase(codeNum); if (table != null && table.Rows.Count > 0) { _gea.GEA002 = table.Rows [0] ["SRT003"].ToString( ); _gea.GEA003 = table.Rows [0] ["SRT004"].ToString( ); _gea.GEA004 = table.Rows [0] ["SRT005"].ToString( ); _gea.GEA005 = table.Rows [0] ["SRT010"].ToString( ); add_gea(SQLString, strSql, _gea); } else { return(false); } _geb.GEB003 = string.Empty; _geb.GEB004 = string.Empty; _geb.GEB005 = null; _geb.GEB007 = null; add_geb_para(SQLString, strSql, _geb); return(SqlHelper.ExecuteSqlTran(SQLString)); }
public FormGeneralAssembly( ) { InitializeComponent( ); _gea = new ProductionErpEntity.GeneralAssemblyGEAEntity( ); _geb = new ProductionErpEntity.GeneralAssemblyGEBEntity( ); _bll = new ProductionErpBll.Bll.GeneralAssemblyBll( ); tableView = new DataTable( ); Utility.GridViewMoHuSelect.SetFilter(gridView1); 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( ); gridView1.OptionsBehavior.Editable = false; }
void add_gea(Hashtable SQLString, StringBuilder strSql, ProductionErpEntity.GeneralAssemblyGEAEntity _gea) { strSql = new StringBuilder( ); strSql.Append("INSERT INTO MOXGEA ("); strSql.Append("GEA001,GEA002,GEA003,GEA004,GEA005) "); strSql.Append("VALUES ("); strSql.Append("@GEA001,@GEA002,@GEA003,@GEA004,@GEA005) "); SqlParameter [] parameter = { new SqlParameter("@GEA001", SqlDbType.NVarChar, 50), new SqlParameter("@GEA002", SqlDbType.NVarChar, 50), new SqlParameter("@GEA003", SqlDbType.NVarChar, 50), new SqlParameter("@GEA004", SqlDbType.NVarChar, 50), new SqlParameter("@GEA005", SqlDbType.NVarChar, 100) }; parameter [0].Value = _gea.GEA001; parameter [1].Value = _gea.GEA002; parameter [2].Value = _gea.GEA003; parameter [3].Value = _gea.GEA004; parameter [4].Value = _gea.GEA005; SQLString.Add(strSql, parameter); }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { _bll.getCodeNum(_gea.GEA001); tableView = _bll.getTableView(_gea.GEA001); _gea = _bll.getModel(_gea.GEA001); }