void add_pqcg(Hashtable SQLString, StringBuilder strSql, MulaolaoLibrary.StandardAuditTreCGEntity model, string logins) { strSql = new StringBuilder( ); strSql.Append("insert into R_PQCG("); strSql.Append("CG001,CG002,CG003,CG004,CG005,CG006,CG007,CG008,CG009,CG010,CG011,CG012,CG013,CG014,CG015,CG016,CG017,CG018,CG019,CG020,CG021,CG022,CG023)"); strSql.Append(" values ("); strSql.Append("@CG001,@CG002,@CG003,@CG004,@CG005,@CG006,@CG007,@CG008,@CG009,@CG010,@CG011,@CG012,@CG013,@CG014,@CG015,@CG016,@CG017,@CG018,@CG019,@CG020,@CG021,@CG022,@CG023)"); SqlParameter [] parameters = { new SqlParameter("@CG001", SqlDbType.NVarChar, 20), new SqlParameter("@CG002", SqlDbType.NVarChar, 20), new SqlParameter("@CG003", SqlDbType.NVarChar, 20), new SqlParameter("@CG004", SqlDbType.NVarChar, 20), new SqlParameter("@CG005", SqlDbType.Date, 3), new SqlParameter("@CG006", SqlDbType.Date, 3), new SqlParameter("@CG007", SqlDbType.NVarChar, 20), new SqlParameter("@CG008", SqlDbType.NVarChar, 20), new SqlParameter("@CG009", SqlDbType.NVarChar, 20), new SqlParameter("@CG010", SqlDbType.NVarChar, 20), new SqlParameter("@CG011", SqlDbType.NVarChar, 20), new SqlParameter("@CG012", SqlDbType.NVarChar, 20), new SqlParameter("@CG013", SqlDbType.NVarChar, 20), new SqlParameter("@CG014", SqlDbType.Date, 3), new SqlParameter("@CG015", SqlDbType.NVarChar, 20), new SqlParameter("@CG016", SqlDbType.Date, 3), new SqlParameter("@CG017", SqlDbType.NVarChar, 20), new SqlParameter("@CG018", SqlDbType.Date, 3), new SqlParameter("@CG019", SqlDbType.NVarChar, 20), new SqlParameter("@CG020", SqlDbType.NVarChar, 20), new SqlParameter("@CG021", SqlDbType.NVarChar, 100), new SqlParameter("@CG022", SqlDbType.NVarChar, 20), new SqlParameter("@CG023", SqlDbType.NVarChar, 20) }; parameters [0].Value = model.CG001; parameters [1].Value = model.CG002; parameters [2].Value = model.CG003; parameters [3].Value = model.CG004; parameters [4].Value = model.CG005; parameters [5].Value = model.CG006; parameters [6].Value = model.CG007; parameters [7].Value = model.CG008; parameters [8].Value = model.CG009; parameters [9].Value = model.CG010; parameters [10].Value = model.CG011; parameters [11].Value = model.CG012; parameters [12].Value = model.CG013; parameters [13].Value = model.CG014; parameters [14].Value = model.CG015; parameters [15].Value = model.CG016; parameters [16].Value = model.CG017; parameters [17].Value = model.CG018; parameters [18].Value = model.CG019; parameters [19].Value = model.CG020; parameters [20].Value = model.CG021; parameters [21].Value = model.CG022; parameters [22].Value = model.CG023; SQLString.Add(strSql, parameters); //SQLString . Add ( Drity . DrityOfComparation ( "R_482" ,"滚、喷、涂漆生产首件标准样审核确认记录表(R_482)" ,logins ,Drity . GetDt ( ) ,model . CG001 ,strSql . ToString ( ) . Replace ( "'" ,"''" ) ,"新增" ,"新增" ) ,null ); }
void delete_pqcg(Hashtable SQLString, StringBuilder strSql, MulaolaoLibrary.StandardAuditTreCGEntity model, string logins) { strSql = new StringBuilder( ); strSql.Append("delete from R_PQCG "); strSql.Append(" where idx=@idx"); SqlParameter [] parameters = { new SqlParameter("@idx", SqlDbType.Int, 4) }; parameters [0].Value = model.idx; SQLString.Add(strSql, parameters); //SQLString . Add ( Drity . DrityOfComparation ( "R_482" ,"滚、喷、涂漆生产首件标准样审核确认记录表(R_482)" ,logins ,Drity . GetDt ( ) ,model . CG001 ,strSql . ToString ( ) . Replace ( "'" ,"''" ) ,"删除" ,"编辑删除" ) ,null ); }
public FormStandardAuditTre( ) { InitializeComponent( ); _cf = new MulaolaoLibrary.StandardAuditTreCFEntity( ); _cg = new MulaolaoLibrary.StandardAuditTreCGEntity( ); _bll = new MulaolaoBll.Bll.StandardAuditTreBll( ); tableView = new DataTable( ); PrintOne = new DataTable( ); PrintTwo = new DataTable( ); GridViewMoHuSelect.SetFilter(secView); GridViewMoHuSelect.SetFilter(bandedGridView1); GrivColumnStyle.setColumnStyle(new DevExpress.XtraGrid.Views.Grid.GridView [] { bandedGridView1 }); Power(this); UnEnable( ); MulaolaoBll.UserInfoMation.tableName = this.Name; secPro.Properties.DataSource = _bll.getProInfo( ); secPro.Properties.DisplayMember = "PQF04"; secPro.Properties.ValueMember = "PQF01"; DataTable dt = _bll.getUser( ); if (dt != null && dt.Rows.Count > 0) { DataTable da = dt.Copy( ).DefaultView.ToTable(true, "CF007"); for (int i = 0; i < da.Rows.Count; i++) { cmbUserOne.Properties.Items.Add(da.Rows [i] ["CF007"].ToString( )); } da = dt.Copy( ).DefaultView.ToTable(true, "CF008"); for (int i = 0; i < da.Rows.Count; i++) { cmbUserTwo.Properties.Items.Add(da.Rows [i] ["CF008"].ToString( )); } da = dt.Copy( ).DefaultView.ToTable(true, "CF009"); for (int i = 0; i < da.Rows.Count; i++) { cmbUserTre.Properties.Items.Add(da.Rows [i] ["CF009"].ToString( )); } da = dt.Copy( ).DefaultView.ToTable(true, "CF010"); for (int i = 0; i < da.Rows.Count; i++) { cmbUserFor.Properties.Items.Add(da.Rows [i] ["CF010"].ToString( )); } } }
void edit_pqcg(Hashtable SQLString, StringBuilder strSql, MulaolaoLibrary.StandardAuditTreCGEntity model, string logins) { strSql = new StringBuilder( ); strSql.Append("update R_PQCG set "); strSql.Append("CG001=@CG001,"); strSql.Append("CG002=@CG002,"); strSql.Append("CG003=@CG003,"); strSql.Append("CG004=@CG004,"); strSql.Append("CG005=@CG005,"); strSql.Append("CG006=@CG006,"); strSql.Append("CG007=@CG007,"); strSql.Append("CG008=@CG008,"); strSql.Append("CG009=@CG009,"); strSql.Append("CG010=@CG010,"); strSql.Append("CG011=@CG011,"); strSql.Append("CG012=@CG012,"); strSql.Append("CG013=@CG013,"); strSql.Append("CG014=@CG014,"); strSql.Append("CG015=@CG015,"); strSql.Append("CG016=@CG016,"); strSql.Append("CG017=@CG017,"); strSql.Append("CG018=@CG018,"); strSql.Append("CG019=@CG019,"); strSql.Append("CG020=@CG020,"); strSql.Append("CG021=@CG021,"); strSql.Append("CG022=@CG022,"); strSql.Append("CG023=@CG023 "); strSql.Append(" where idx=@idx"); SqlParameter [] parameters = { new SqlParameter("@CG001", SqlDbType.NVarChar, 20), new SqlParameter("@CG002", SqlDbType.NVarChar, 20), new SqlParameter("@CG003", SqlDbType.NVarChar, 20), new SqlParameter("@CG004", SqlDbType.NVarChar, 20), new SqlParameter("@CG005", SqlDbType.Date, 3), new SqlParameter("@CG006", SqlDbType.Date, 3), new SqlParameter("@CG007", SqlDbType.NVarChar, 20), new SqlParameter("@CG008", SqlDbType.NVarChar, 20), new SqlParameter("@CG009", SqlDbType.NVarChar, 20), new SqlParameter("@CG010", SqlDbType.NVarChar, 20), new SqlParameter("@CG011", SqlDbType.NVarChar, 20), new SqlParameter("@CG012", SqlDbType.NVarChar, 20), new SqlParameter("@CG013", SqlDbType.NVarChar, 20), new SqlParameter("@CG014", SqlDbType.Date, 3), new SqlParameter("@CG015", SqlDbType.NVarChar, 20), new SqlParameter("@CG016", SqlDbType.Date, 3), new SqlParameter("@CG017", SqlDbType.NVarChar, 20), new SqlParameter("@CG018", SqlDbType.Date, 3), new SqlParameter("@CG019", SqlDbType.NVarChar, 20), new SqlParameter("@CG020", SqlDbType.NVarChar, 20), new SqlParameter("@CG021", SqlDbType.NVarChar, 100), new SqlParameter("@CG022", SqlDbType.NVarChar, 20), new SqlParameter("@CG023", SqlDbType.NVarChar, 20), new SqlParameter("@idx", SqlDbType.Int, 4) }; parameters [0].Value = model.CG001; parameters [1].Value = model.CG002; parameters [2].Value = model.CG003; parameters [3].Value = model.CG004; parameters [4].Value = model.CG005; parameters [5].Value = model.CG006; parameters [6].Value = model.CG007; parameters [7].Value = model.CG008; parameters [8].Value = model.CG009; parameters [9].Value = model.CG010; parameters [10].Value = model.CG011; parameters [11].Value = model.CG012; parameters [12].Value = model.CG013; parameters [13].Value = model.CG014; parameters [14].Value = model.CG015; parameters [15].Value = model.CG016; parameters [16].Value = model.CG017; parameters [17].Value = model.CG018; parameters [18].Value = model.CG019; parameters [19].Value = model.CG020; parameters [20].Value = model.CG021; parameters [21].Value = model.CG022; parameters [22].Value = model.CG023; parameters [23].Value = model.idx; SQLString.Add(strSql, parameters); //SQLString . Add ( Drity . DrityOfComparation ( "R_482" ,"滚、喷、涂漆生产首件标准样审核确认记录表(R_482)" ,logins ,Drity . GetDt ( ) ,model . CG001 ,strSql . ToString ( ) . Replace ( "'" ,"''" ) ,"编辑" ,"编辑" ) ,null ); }
/// <summary> /// edit data from r_pqcb and r_pqcc to database /// </summary> /// <param name="table"></param> /// <param name="_cb"></param> /// <param name="logins"></param> /// <param name="strList"></param> /// <returns></returns> public bool Edit(DataTable table, MulaolaoLibrary.StandardAuditTreCFEntity _cf, string logins, List <string> strList) { Hashtable SQLString = new Hashtable( ); StringBuilder strSql = new StringBuilder( ); edit_pqcf(SQLString, strSql, _cf); SQLString.Add(Drity.DrityOfComparation("R_484", "动力段生产首件量.检具审核确认记录表(R_484)", logins, Drity.GetDt( ), _cf.CF001, strSql.ToString( ).Replace("'", "''"), "编辑", "编辑"), null); MulaolaoLibrary.StandardAuditTreCGEntity _ce = new MulaolaoLibrary.StandardAuditTreCGEntity( ); _ce.CG001 = _cf.CF001; for (int i = 0; i < table.Rows.Count; i++) { _ce.CG002 = table.Rows [i] ["CG002"].ToString( ); _ce.CG003 = table.Rows [i] ["CG003"].ToString( ); _ce.CG004 = table.Rows [i] ["CG004"].ToString( ); if (string.IsNullOrEmpty(table.Rows [i] ["CG005"].ToString( ))) { _ce.CG005 = null; } else { _ce.CG005 = Convert.ToDateTime(table.Rows [i] ["CG005"]); } if (string.IsNullOrEmpty(table.Rows [i] ["CG006"].ToString( ))) { _ce.CG006 = null; } else { _ce.CG006 = Convert.ToDateTime(table.Rows [i] ["CG006"]); } _ce.CG007 = table.Rows [i] ["CG007"].ToString( ); _ce.CG008 = table.Rows [i] ["CG008"].ToString( ); _ce.CG009 = table.Rows [i] ["CG009"].ToString( ); _ce.CG010 = table.Rows [i] ["CG010"].ToString( ); _ce.CG011 = table.Rows [i] ["CG011"].ToString( ); _ce.CG012 = table.Rows [i] ["CG012"].ToString( ); _ce.CG013 = table.Rows [i] ["CG013"].ToString( ); if (string.IsNullOrEmpty(table.Rows [i] ["CG014"].ToString( ))) { _ce.CG014 = null; } else { _ce.CG014 = Convert.ToDateTime(table.Rows [i] ["CG014"]); } _ce.CG015 = table.Rows [i] ["CG015"].ToString( ); if (string.IsNullOrEmpty(table.Rows [i] ["CG016"].ToString( ))) { _ce.CG016 = null; } else { _ce.CG016 = Convert.ToDateTime(table.Rows [i] ["CG016"]); } _ce.CG017 = table.Rows [i] ["CG017"].ToString( ); if (string.IsNullOrEmpty(table.Rows [i] ["CG018"].ToString( ))) { _ce.CG018 = null; } else { _ce.CG018 = Convert.ToDateTime(table.Rows [i] ["CG018"]); } _ce.CG019 = table.Rows [i] ["CG019"].ToString( ); _ce.CG020 = table.Rows [i] ["CG020"].ToString( ); _ce.CG021 = table.Rows [i] ["CG021"].ToString( ); _ce.CG022 = table.Rows [i] ["CG022"].ToString( ); _ce.CG023 = table.Rows [i] ["CG023"].ToString( ); _ce.idx = string.IsNullOrEmpty(table.Rows [i] ["idx"].ToString( )) == true ? 0 : Convert.ToInt32(table.Rows [i] ["idx"].ToString( )); if (_ce.idx < 1) { add_pqcg(SQLString, strSql, _ce, logins); } else { edit_pqcg(SQLString, strSql, _ce, logins); } } foreach (string s in strList) { _ce.idx = Convert.ToInt32(s); delete_pqcg(SQLString, strSql, _ce, logins); } return(SqlHelper.ExecuteSqlTran(SQLString)); }