void delete_wy(Hashtable SQLString, StringBuilder strSql, MulaolaoLibrary.DetailedDeductionWYLibrary model) { strSql = new StringBuilder( ); strSql.AppendFormat("DELETE FROM R_PQWY WHERE idx={0}", model.idx); SQLString.Add(strSql, null); }
public DetailedDeductionChildTable(int idx) { InitializeComponent( ); _wy = new MulaolaoLibrary.DetailedDeductionWYLibrary( ); _bll = new MulaolaoBll.Bll.DetailedDeductionBll( ); _wy.idx = idx; //Task<DataTable> task = new Task<DataTable> ( getTableView ,_wy . idx ); //task . Start ( ); tableView = _bll.getTableOf(Convert.ToInt32(idx)); gridControl1.DataSource = tableView; }
public R_FrmDetailedDeduction( ) { InitializeComponent( ); _model = new MulaolaoLibrary.DetailedDeductionLibrary( ); _wy = new MulaolaoLibrary.DetailedDeductionWYLibrary( ); _bll = new MulaolaoBll.Bll.DetailedDeductionBll( ); GridViewMoHuSelect.SetFilter(gridView1); GrivColumnStyle.setColumnStyle(new DevExpress.XtraGrid.Views.Grid.GridView [] { gridView1, gridView3 }); MulaolaoBll.UserInfoMation.tableName = this.Name; }
void edit_wy(Hashtable SQLString, StringBuilder strSql, MulaolaoLibrary.DetailedDeductionWYLibrary model) { strSql = new StringBuilder( ); strSql.Append("UPDATE R_PQWY SET "); strSql.Append("WY002=@WY002 "); strSql.Append("WHERE idx=@idx"); SqlParameter [] parameter = { new SqlParameter("@WY002", SqlDbType.Decimal), new SqlParameter("@idx", SqlDbType.Int, 4) }; parameter [0].Value = model.WY002; parameter [1].Value = model.idx; SQLString.Add(strSql, parameter); }
/// <summary> /// 保存数据 /// </summary> /// <param name="table"></param> /// <param name="idxList"></param> /// <param name="logins"></param> /// <returns></returns> public bool Save(DataTable table, List <string> idxList, string logins) { Hashtable SQLString = new Hashtable( ); StringBuilder strSql = new StringBuilder( ); MulaolaoLibrary.DetailedDeductionWYLibrary model = new MulaolaoLibrary.DetailedDeductionWYLibrary( ); for (int i = 0; i < table.Rows.Count; i++) { model.idx = string.IsNullOrEmpty(table.Rows [i] ["idx"].ToString( )) == true ? 0 : Convert.ToInt32(table.Rows [i] ["idx"].ToString( )); model.WY001 = string.IsNullOrEmpty(table.Rows [i] ["WY001"].ToString( )) == true ? 0 : Convert.ToInt32(table.Rows [i] ["WY001"].ToString( )); model.WY002 = string.IsNullOrEmpty(table.Rows [i] ["WY002"].ToString( )) == true ? 0 : Convert.ToDecimal(table.Rows [i] ["WY002"].ToString( )); if (string.IsNullOrEmpty(table.Rows [i] ["WY003"].ToString( ))) { model.WY003 = null; } else { model.WY003 = Convert.ToDateTime(table.Rows [i] ["WY003"].ToString( )); } model.WY004 = table.Rows [i] ["WY004"].ToString( ); if (model.idx > 0) { edit_wy(SQLString, strSql, model); SQLString.Add(Drity.DrityOfComparation("R_244" + i, "244本次付款金额", logins, MulaolaoBll.Drity.GetDt( ), model.idx.ToString( ), strSql.ToString( ).Replace("'", "''"), "新增", "新增"), null); } else { add_wy(SQLString, strSql, model); SQLString.Add(Drity.DrityOfComparation("R_244" + i, "244本次付款金额", logins, MulaolaoBll.Drity.GetDt( ), model.idx.ToString( ), strSql.ToString( ).Replace("'", "''"), "编辑", "编辑"), null); } } if (idxList.Count > 0) { foreach (string s in idxList) { model.idx = Convert.ToInt32(s); delete_wy(SQLString, strSql, model); SQLString.Add(Drity.DrityOfComparation("R_244" + model.idx, "244本次付款金额", logins, MulaolaoBll.Drity.GetDt( ), model.idx.ToString( ), strSql.ToString( ).Replace("'", "''"), "删除", "删除"), null); } } return(SqlHelper.ExecuteSqlTran(SQLString)); }
void add_wy(Hashtable SQLString, StringBuilder strSql, MulaolaoLibrary.DetailedDeductionWYLibrary model) { strSql = new StringBuilder( ); strSql.Append("INSERT INTO R_PQWY ("); strSql.Append("WY001,WY002,WY003,WY004) "); strSql.Append("VALUES ("); strSql.Append("@WY001,@WY002,@WY003,@WY004) "); SqlParameter [] parameter = { new SqlParameter("@WY001", SqlDbType.Int, 4), new SqlParameter("@WY002", SqlDbType.Decimal), new SqlParameter("@WY003", SqlDbType.Date, 3), new SqlParameter("@WY004", SqlDbType.NVarChar, 50) }; parameter [0].Value = model.WY001; parameter [1].Value = model.WY002; parameter [2].Value = model.WY003; parameter [3].Value = model.WY004; SQLString.Add(strSql, parameter); }