void delete_pda(Hashtable SQLString, StringBuilder strSql, MaterileEntity.MaterielPDAEntity _pda) { strSql = new StringBuilder( ); strSql.Append("DELETE FROM TENPDA "); strSql.AppendFormat("WHERE PDA001='{0}' AND PDA002='{1}'", _pda.PDA001, _pda.PDA002); SQLString.Add(strSql, null); }
void add_pda(Hashtable SQLString, StringBuilder strSql, MaterileEntity.MaterielPDAEntity _pda) { strSql = new StringBuilder( ); strSql.Append("INSERT INTO TENPDA ("); strSql.Append("PDA001,PDA002,PDA003,PDA004,PDA005,PDA006,PDA007,PDA008,PDA009,PDA010,PDA011,PDA012,PDA013,PDA014,PDA015,PDA016,PDA017,PDA018) "); strSql.Append("VALUES ("); strSql.Append("@PDA001,@PDA002,@PDA003,@PDA004,@PDA005,@PDA006,@PDA007,@PDA008,@PDA009,@PDA010,@PDA011,@PDA012,@PDA013,@PDA014,@PDA015,@PDA016,@PDA017,@PDA018)"); SqlParameter [] paramete = { new SqlParameter("@PDA001", SqlDbType.NVarChar, 200), new SqlParameter("@PDA002", SqlDbType.NVarChar, 200), new SqlParameter("@PDA003", SqlDbType.NVarChar, 200), new SqlParameter("@PDA004", SqlDbType.Int), new SqlParameter("@PDA005", SqlDbType.NVarChar, 5), new SqlParameter("@PDA006", SqlDbType.Decimal, 10), new SqlParameter("@PDA007", SqlDbType.NVarChar, 200), new SqlParameter("@PDA008", SqlDbType.Decimal, 5), new SqlParameter("@PDA009", SqlDbType.Decimal, 5), new SqlParameter("@PDA010", SqlDbType.Decimal, 5), new SqlParameter("@PDA011", SqlDbType.NVarChar, 200), new SqlParameter("@PDA012", SqlDbType.Decimal, 5), new SqlParameter("@PDA013", SqlDbType.Decimal, 5), new SqlParameter("@PDA014", SqlDbType.Decimal, 5), new SqlParameter("@PDA015", SqlDbType.Int), new SqlParameter("@PDA016", SqlDbType.NVarChar, 200), new SqlParameter("@PDA017", SqlDbType.Decimal, 5), new SqlParameter("@PDA018", SqlDbType.NVarChar, 200) }; paramete [0].Value = _pda.PDA001; paramete [1].Value = _pda.PDA002; paramete [2].Value = _pda.PDA003; paramete [3].Value = _pda.PDA004; paramete [4].Value = _pda.PDA005; paramete [5].Value = _pda.PDA006; paramete [6].Value = _pda.PDA007; paramete [7].Value = _pda.PDA008; paramete [8].Value = _pda.PDA009; paramete [9].Value = _pda.PDA010; paramete [10].Value = _pda.PDA011; paramete [11].Value = _pda.PDA012; paramete [12].Value = _pda.PDA013; paramete [13].Value = _pda.PDA014; paramete [14].Value = _pda.PDA015; paramete [15].Value = _pda.PDA016; paramete [16].Value = _pda.PDA017; paramete [17].Value = _pda.PDA018; SQLString.Add(strSql, paramete); }
void add_pda(Hashtable SQLString, StringBuilder strSql, string contractNum, DataTable tableOne) { MaterileEntity.MaterielPDAEntity _pda = new MaterileEntity.MaterielPDAEntity( ); _pda.PDA001 = contractNum; DataTable dt = dt_one(_pda.PDA001); for (int i = 0; i < tableOne.Rows.Count; i++) { _pda.PDA002 = tableOne.Rows [i] ["PDA002"].ToString( ); _pda.PDA003 = tableOne.Rows [i] ["PDA003"].ToString( ); _pda.PDA004 = string.IsNullOrEmpty(tableOne.Rows [i] ["PDA004"].ToString( )) == true ? 0 : Convert.ToInt32(tableOne.Rows [i] ["PDA004"].ToString( )); _pda.PDA005 = tableOne.Rows [i] ["PDA005"].ToString( ); _pda.PDA006 = string.IsNullOrEmpty(tableOne.Rows [i] ["PDA006"].ToString( )) == true ? 0 : Convert.ToDecimal(tableOne.Rows [i] ["PDA006"].ToString( )); _pda.PDA007 = tableOne.Rows [i] ["PDA007"].ToString( ); _pda.PDA008 = string.IsNullOrEmpty(tableOne.Rows [i] ["PDA008"].ToString( )) == true ? 0 : Convert.ToDecimal(tableOne.Rows [i] ["PDA008"].ToString( )); _pda.PDA009 = string.IsNullOrEmpty(tableOne.Rows [i] ["PDA009"].ToString( )) == true ? 0 : Convert.ToDecimal(tableOne.Rows [i] ["PDA009"].ToString( )); _pda.PDA010 = string.IsNullOrEmpty(tableOne.Rows [i] ["PDA010"].ToString( )) == true ? 0 : Convert.ToDecimal(tableOne.Rows [i] ["PDA010"].ToString( )); _pda.PDA011 = tableOne.Rows [i] ["PDA011"].ToString( ); _pda.PDA012 = string.IsNullOrEmpty(tableOne.Rows [i] ["PDA012"].ToString( )) == true ? 0 : Convert.ToDecimal(tableOne.Rows [i] ["PDA012"].ToString( )); _pda.PDA013 = string.IsNullOrEmpty(tableOne.Rows [i] ["PDA013"].ToString( )) == true ? 0 : Convert.ToDecimal(tableOne.Rows [i] ["PDA013"].ToString( )); _pda.PDA014 = string.IsNullOrEmpty(tableOne.Rows [i] ["PDA014"].ToString( )) == true ? 0 : Convert.ToDecimal(tableOne.Rows [i] ["PDA014"].ToString( )); _pda.PDA015 = string.IsNullOrEmpty(tableOne.Rows [i] ["PDA015"].ToString( )) == true ? 0 : Convert.ToInt32(tableOne.Rows [i] ["PDA015"].ToString( )); _pda.PDA016 = tableOne.Rows [i] ["PDA016"].ToString( ); _pda.PDA017 = string.IsNullOrEmpty(tableOne.Rows [i] ["PDA017"].ToString( )) == true ? 0 : Convert.ToDecimal(tableOne.Rows [i] ["PDA017"].ToString( )); _pda.PDA018 = tableOne.Rows [i] ["PDA018"].ToString( ); if (dt.Select("PDA002='" + _pda.PDA002 + "'").Length < 1) { add_pda(SQLString, strSql, _pda); } else { edit_pda(SQLString, strSql, _pda); } } for (int i = 0; i < dt.Rows.Count; i++) { _pda.PDA002 = dt.Rows [i] ["PDA002"].ToString( ); if (tableOne.Select("PDA002='" + _pda.PDA002 + "'").Length < 1) { delete_pda(SQLString, strSql, _pda); } } }
public Form1( ) { InitializeComponent( ); _pda = new MaterileEntity.MaterielPDAEntity( ); _pdu = new MaterileEntity.MaterielPDUEntity( ); _pdc = new MaterileEntity.MaterielPDCEntity( ); _pdb = new MaterileEntity.MaterielPDBEntity( ); _bll = new MaterielBll.Bll.MaterielBll( ); tableOne = new DataTable( ); tableTwo = new DataTable( ); tableTre = new DataTable( ); printOne = new DataTable( ); printTwo = new DataTable( ); controlUnEnable( ); Utility.GridViewMoHuSelect.SetFilter(bandedGridView1); FieldInfo fi = typeof(DevExpress.Utils.Paint.XPaint).GetField("graphics", BindingFlags.Static | BindingFlags.NonPublic); fi.SetValue(null, new DrawXPaint( )); }
void edit_pda(Hashtable SQLString, StringBuilder strSql, MaterileEntity.MaterielPDAEntity _pda) { strSql = new StringBuilder( ); strSql.Append("UPDATE TENPDA SET "); strSql.Append("PDA003=@PDA003,"); strSql.Append("PDA004=@PDA004,"); strSql.Append("PDA005=@PDA005,"); strSql.Append("PDA006=@PDA006,"); strSql.Append("PDA007=@PDA007,"); strSql.Append("PDA008=@PDA008,"); strSql.Append("PDA009=@PDA009,"); strSql.Append("PDA010=@PDA010,"); strSql.Append("PDA011=@PDA011,"); strSql.Append("PDA012=@PDA012,"); strSql.Append("PDA013=@PDA013,"); strSql.Append("PDA014=@PDA014,"); strSql.Append("PDA015=@PDA015,"); strSql.Append("PDA016=@PDA016,"); strSql.Append("PDA017=@PDA017,"); strSql.Append("PDA018=@PDA018 "); strSql.Append("WHERE PDA001=@PDA001 AND "); strSql.Append("PDA002=@PDA002"); SqlParameter [] paramete = { new SqlParameter("@PDA001", SqlDbType.NVarChar, 200), new SqlParameter("@PDA002", SqlDbType.NVarChar, 200), new SqlParameter("@PDA003", SqlDbType.NVarChar, 200), new SqlParameter("@PDA004", SqlDbType.Int), new SqlParameter("@PDA005", SqlDbType.NVarChar, 5), new SqlParameter("@PDA006", SqlDbType.Decimal, 10), new SqlParameter("@PDA007", SqlDbType.NVarChar, 200), new SqlParameter("@PDA008", SqlDbType.Decimal, 5), new SqlParameter("@PDA009", SqlDbType.Decimal, 5), new SqlParameter("@PDA010", SqlDbType.Decimal, 5), new SqlParameter("@PDA011", SqlDbType.NVarChar, 200), new SqlParameter("@PDA012", SqlDbType.Decimal, 5), new SqlParameter("@PDA013", SqlDbType.Decimal, 5), new SqlParameter("@PDA014", SqlDbType.Decimal, 5), new SqlParameter("@PDA015", SqlDbType.Int), new SqlParameter("@PDA016", SqlDbType.NVarChar, 200), new SqlParameter("@PDA017", SqlDbType.Decimal, 5), new SqlParameter("@PDA018", SqlDbType.NVarChar, 200) }; paramete [0].Value = _pda.PDA001; paramete [1].Value = _pda.PDA002; paramete [2].Value = _pda.PDA003; paramete [3].Value = _pda.PDA004; paramete [4].Value = _pda.PDA005; paramete [5].Value = _pda.PDA006; paramete [6].Value = _pda.PDA007; paramete [7].Value = _pda.PDA008; paramete [8].Value = _pda.PDA009; paramete [9].Value = _pda.PDA010; paramete [10].Value = _pda.PDA011; paramete [11].Value = _pda.PDA012; paramete [12].Value = _pda.PDA013; paramete [13].Value = _pda.PDA014; paramete [14].Value = _pda.PDA015; paramete [15].Value = _pda.PDA016; paramete [16].Value = _pda.PDA017; paramete [17].Value = _pda.PDA018; SQLString.Add(strSql, paramete); }