void add_pqcb(Hashtable SQLString, StringBuilder strSql, MulaolaoLibrary.StandardAuditOneCBEntity model) { strSql = new StringBuilder( ); strSql.Append("insert into R_PQCB("); strSql.Append("CB001,CB002,CB003,CB004,CB005,CB006,CB007,CB008,CB009,CB010)"); strSql.Append(" values ("); strSql.Append("@CB001,@CB002,@CB003,@CB004,@CB005,@CB006,@CB007,@CB008,@CB009,@CB010)"); SqlParameter [] parameters = { new SqlParameter("@CB001", SqlDbType.NVarChar, 20), new SqlParameter("@CB002", SqlDbType.NVarChar, 20), new SqlParameter("@CB003", SqlDbType.NVarChar, 50), new SqlParameter("@CB004", SqlDbType.NVarChar, 20), new SqlParameter("@CB005", SqlDbType.Int, 4), new SqlParameter("@CB006", SqlDbType.NVarChar, 50), new SqlParameter("@CB007", SqlDbType.NVarChar, 20), new SqlParameter("@CB008", SqlDbType.NVarChar, 20), new SqlParameter("@CB009", SqlDbType.NVarChar, 20), new SqlParameter("@CB010", SqlDbType.NVarChar, 20) }; parameters [0].Value = model.CB001; parameters [1].Value = model.CB002; parameters [2].Value = model.CB003; parameters [3].Value = model.CB004; parameters [4].Value = model.CB005; parameters [5].Value = model.CB006; parameters [6].Value = model.CB007; parameters [7].Value = model.CB008; parameters [8].Value = model.CB009; parameters [9].Value = model.CB010; SQLString.Add(strSql, parameters); }
public FormStandardAuditOne( ) { InitializeComponent( ); GridViewMoHuSelect.SetFilter(secView); GridViewMoHuSelect.SetFilter(bandedGridView1); GrivColumnStyle.setColumnStyle(new DevExpress.XtraGrid.Views.Grid.GridView [] { bandedGridView1 }); MulaolaoBll.UserInfoMation.tableName = this.Name; _cb = new MulaolaoLibrary.StandardAuditOneCBEntity( ); _cc = new MulaolaoLibrary.StandardAuditOneCCEntity( ); _bll = new MulaolaoBll.Bll.StandardAuditOneBll( ); tableView = new DataTable( ); printOne = new DataTable( ); printTwo = new DataTable( ); Power(this); UnEnable( ); 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, "CB007"); for (int i = 0; i < da.Rows.Count; i++) { cmbUserOne.Properties.Items.Add(da.Rows [i] ["CB007"].ToString( )); } da = dt.Copy( ).DefaultView.ToTable(true, "CB008"); for (int i = 0; i < da.Rows.Count; i++) { cmbUserTwo.Properties.Items.Add(da.Rows [i] ["CB008"].ToString( )); } da = dt.Copy( ).DefaultView.ToTable(true, "CB009"); for (int i = 0; i < da.Rows.Count; i++) { cmbUserTre.Properties.Items.Add(da.Rows [i] ["CB009"].ToString( )); } da = dt.Copy( ).DefaultView.ToTable(true, "CB010"); for (int i = 0; i < da.Rows.Count; i++) { cmbUserFor.Properties.Items.Add(da.Rows [i] ["CB010"].ToString( )); } } }
public MulaolaoLibrary.StandardAuditOneCBEntity getDataRow(DataRow row) { MulaolaoLibrary.StandardAuditOneCBEntity model = new MulaolaoLibrary.StandardAuditOneCBEntity( ); if (row != null) { if (row ["CB001"] != null) { model.CB001 = row ["CB001"].ToString( ); } if (row ["CB002"] != null) { model.CB002 = row ["CB002"].ToString( ); } if (row ["CB003"] != null) { model.CB003 = row ["CB003"].ToString( ); } if (row ["CB004"] != null) { model.CB004 = row ["CB004"].ToString( ); } if (row ["CB005"] != null && row ["CB005"].ToString( ) != string.Empty) { model.CB005 = int.Parse(row ["CB005"].ToString( )); } if (row ["CB006"] != null) { model.CB006 = row ["CB006"].ToString( ); } if (row ["CB007"] != null) { model.CB007 = row ["CB007"].ToString( ); } if (row ["CB008"] != null) { model.CB008 = row ["CB008"].ToString( ); } if (row ["CB009"] != null) { model.CB009 = row ["CB009"].ToString( ); } if (row ["CB010"] != null) { model.CB010 = row ["CB010"].ToString( ); } } return(model); }
void getData( ) { _cb = _bll.getModel(_cb.CB001); secPro.EditValue = _cb.CB002; txtNum.Text = _cb.CB002; txtNo.Text = _cb.CB004; txtNumer.Text = _cb.CB005.ToString( ); txtColor.Text = _cb.CB006; cmbUserOne.Text = _cb.CB007; cmbUserTwo.Text = _cb.CB008; cmbUserTre.Text = _cb.CB009; cmbUserFor.Text = _cb.CB010; tableView = _bll.getView(" CC001='" + _cb.CB001 + "'"); gridControl1.DataSource = tableView; }
void edit_pqcb(Hashtable SQLString, StringBuilder strSql, MulaolaoLibrary.StandardAuditOneCBEntity model) { strSql = new StringBuilder( ); strSql.Append("update R_PQCB set "); strSql.Append("CB002=@CB002,"); strSql.Append("CB003=@CB003,"); strSql.Append("CB004=@CB004,"); strSql.Append("CB005=@CB005,"); strSql.Append("CB006=@CB006,"); strSql.Append("CB007=@CB007,"); strSql.Append("CB008=@CB008,"); strSql.Append("CB009=@CB009,"); strSql.Append("CB010=@CB010 "); strSql.Append(" where CB001=@CB001"); SqlParameter [] parameters = { new SqlParameter("@CB001", SqlDbType.NVarChar, 20), new SqlParameter("@CB002", SqlDbType.NVarChar, 20), new SqlParameter("@CB003", SqlDbType.NVarChar, 50), new SqlParameter("@CB004", SqlDbType.NVarChar, 20), new SqlParameter("@CB005", SqlDbType.Int, 4), new SqlParameter("@CB006", SqlDbType.NVarChar, 50), new SqlParameter("@CB007", SqlDbType.NVarChar, 20), new SqlParameter("@CB008", SqlDbType.NVarChar, 20), new SqlParameter("@CB009", SqlDbType.NVarChar, 20), new SqlParameter("@CB010", SqlDbType.NVarChar, 20) }; parameters [0].Value = model.CB001; parameters [1].Value = model.CB002; parameters [2].Value = model.CB003; parameters [3].Value = model.CB004; parameters [4].Value = model.CB005; parameters [5].Value = model.CB006; parameters [6].Value = model.CB007; parameters [7].Value = model.CB008; parameters [8].Value = model.CB009; parameters [9].Value = model.CB010; SQLString.Add(strSql, parameters); }
/// <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.StandardAuditOneCBEntity _cb, string logins, List <string> strList) { Hashtable SQLString = new Hashtable( ); StringBuilder strSql = new StringBuilder( ); edit_pqcb(SQLString, strSql, _cb); SQLString.Add(Drity.DrityOfComparation("R_482", "滚、喷、涂漆生产首件标准样审核确认记录表(R_482)", logins, Drity.GetDt( ), _cb.CB001, strSql.ToString( ).Replace("'", "''"), "编辑", "编辑"), null); MulaolaoLibrary.StandardAuditOneCCEntity _cc = new MulaolaoLibrary.StandardAuditOneCCEntity( ); _cc.CC001 = _cb.CB001; for (int i = 0; i < table.Rows.Count; i++) { _cc.CC002 = table.Rows [i] ["CC002"].ToString( ); _cc.CC003 = table.Rows [i] ["CC003"].ToString( ); _cc.CC004 = table.Rows [i] ["CC004"].ToString( ); if (string.IsNullOrEmpty(table.Rows [i] ["CC005"].ToString( ))) { _cc.CC005 = null; } else { _cc.CC005 = Convert.ToDateTime(table.Rows [i] ["CC005"]); } if (string.IsNullOrEmpty(table.Rows [i] ["CC006"].ToString( ))) { _cc.CC006 = null; } else { _cc.CC006 = Convert.ToDateTime(table.Rows [i] ["CC006"]); } _cc.CC007 = table.Rows [i] ["CC007"].ToString( ); _cc.CC008 = table.Rows [i] ["CC008"].ToString( ); _cc.CC009 = table.Rows [i] ["CC009"].ToString( ); _cc.CC010 = table.Rows [i] ["CC010"].ToString( ); _cc.CC011 = table.Rows [i] ["CC011"].ToString( ); _cc.CC012 = table.Rows [i] ["CC012"].ToString( ); _cc.CC013 = table.Rows [i] ["CC013"].ToString( ); if (string.IsNullOrEmpty(table.Rows [i] ["CC014"].ToString( ))) { _cc.CC014 = null; } else { _cc.CC014 = Convert.ToDateTime(table.Rows [i] ["CC014"]); } _cc.CC015 = table.Rows [i] ["CC015"].ToString( ); if (string.IsNullOrEmpty(table.Rows [i] ["CC016"].ToString( ))) { _cc.CC016 = null; } else { _cc.CC016 = Convert.ToDateTime(table.Rows [i] ["CC016"]); } _cc.CC017 = table.Rows [i] ["CC017"].ToString( ); if (string.IsNullOrEmpty(table.Rows [i] ["CC018"].ToString( ))) { _cc.CC018 = null; } else { _cc.CC018 = Convert.ToDateTime(table.Rows [i] ["CC018"]); } _cc.CC019 = table.Rows [i] ["CC019"].ToString( ); if (string.IsNullOrEmpty(table.Rows [i] ["CC020"].ToString( ))) { _cc.CC020 = null; } else { _cc.CC020 = Convert.ToDateTime(table.Rows [i] ["CC020"]); } _cc.CC021 = table.Rows [i] ["CC021"].ToString( ); _cc.idx = string.IsNullOrEmpty(table.Rows [i] ["idx"].ToString( )) == true ? 0 : Convert.ToInt32(table.Rows [i] ["idx"].ToString( )); if (_cc.idx < 1) { add_pqcc(SQLString, strSql, _cc, logins); } else { edit_pqcc(SQLString, strSql, _cc, logins); } } foreach (string s in strList) { _cc.idx = Convert.ToInt32(s); delete_pqcc(SQLString, strSql, _cc, logins); } return(SqlHelper.ExecuteSqlTran(SQLString)); }
/// <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.StandardAuditOneCBEntity _cb, string logins, List <string> strList) { return(_dal.Edit(table, _cb, logins, strList)); }
/// <summary> /// save data to r_pqcb and r_pqcc /// </summary> /// <param name="table"></param> /// <param name="_cb"></param> /// <returns></returns> public bool Save(DataTable table, MulaolaoLibrary.StandardAuditOneCBEntity _cb, string logins) { return(_dal.Save(table, _cb, logins)); }