public static BG_ProPay AddBG_ProPay(BG_ProPay bG_ProPay) { string sql = "INSERT BG_ProPay (DepID, ProPYear, PPID, ProPA0M)" + "VALUES (@DepID, @ProPYear, @PPID, @ProPA0M)"; sql += " ; SELECT @@IDENTITY"; try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@DepID", bG_ProPay.DepID), new SqlParameter("@ProPYear", bG_ProPay.ProPYear), new SqlParameter("@PPID", bG_ProPay.PPID), new SqlParameter("@ProPA0M", bG_ProPay.ProPA0M) }; string IdStr = DBUnity.ExecuteScalar(CommandType.Text, sql, para); int newId = Convert.ToInt32(IdStr); return GetBG_ProPayByProPID(newId); } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
protected void btnAdd4_Click(object sender, DirectEventArgs e) { BG_ProPay pp = new BG_ProPay(); pp.DepID = AreaDepID; pp.ProPYear = DateTime.Now; pp.PPID = ID.ToString(); pp.ProPA0M = Field; BG_ProPayManager.AddBG_ProPay(pp); //PreviewDataBind(); }
private void IsnotBG_ProBasiPerPay() { byte[] bt; DataTable dt1 = new DataTable(); DataTable dt2 = new DataTable(); DataTable dt3 = new DataTable(); DataTable dt4 = new DataTable(); if (FUFEXC.HasFile) { bt = FUFEXC.FileBytes; dt1 = ImportFinaDataLogic.GetDTBySheetname("基人一", bt, 9, 10); dt2 = ImportFinaDataLogic.GetDTBySheetname("基人二", bt, 10, 12); dt3 = ImportFinaDataLogic.GetDTBySheetname("基公", bt, 9, 21); dt4 = ImportFinaDataLogic.GetDTBySheetname("项目支出", bt, 9, 15); } else { Response.Write("没有数据"); } bt = null; DateTime dtime = Convert.ToDateTime(CurrentYear + "-" + "01-" + "01"); BG_ProBasiPerPayOne PBPPOM = new BG_ProBasiPerPayOne(); PBPPOM.POBS = ParToDecimal.ParToDel(dt1.Rows[0][4].ToString()); PBPPOM.POAS = ParToDecimal.ParToDel(dt1.Rows[0][5].ToString()); PBPPOM.POBonus = ParToDecimal.ParToDel(dt1.Rows[0][6].ToString()); PBPPOM.POPS = ParToDecimal.ParToDel(dt1.Rows[0][7].ToString()); PBPPOM.POSE = ParToDecimal.ParToDel(dt1.Rows[0][8].ToString()); PBPPOM.POOther = ParToDecimal.ParToDel(dt1.Rows[0][9].ToString()); PBPPOM.POTitol = ParToDecimal.ParToDel(dt1.Rows[0][3].ToString()); PBPPOM.POYear = dtime; PBPPOM.DepID = AreaDepID; BG_ProBasiPerPayOneManager.AddBG_ProBasiPerPayOne(PBPPOM); BG_ProBasiPerPayTwo PBPPT = new BG_ProBasiPerPayTwo(); PBPPT.RetiredPerP = ParToDecimal.ParToDel(dt2.Rows[0][5].ToString()); PBPPT.RetiredPubP = ParToDecimal.ParToDel(dt2.Rows[0][6].ToString()); PBPPT.RetirementPerP = ParToDecimal.ParToDel(dt2.Rows[0][9].ToString()); PBPPT.RetirementPubP = ParToDecimal.ParToDel(dt2.Rows[0][8].ToString()); PBPPT.PTME = ParToDecimal.ParToDel(dt2.Rows[0][10].ToString()); PBPPT.PTOther = ParToDecimal.ParToDel(dt2.Rows[0][11].ToString()); PBPPT.PTTitol = ParToDecimal.ParToDel(dt2.Rows[0][3].ToString()); PBPPT.PTYear = dtime; PBPPT.DepID = AreaDepID; BG_ProBasiPerPayTwoManager.AddBG_ProBasiPerPayTwo(PBPPT); BG_ProBasiPubPay PBPP = new BG_ProBasiPubPay(); PBPP.PBOE = ParToDecimal.ParToDel(dt3.Rows[0][5].ToString()); PBPP.PBUtilities = ParToDecimal.ParToDel(dt3.Rows[0][6].ToString()); PBPP.PBPF = ParToDecimal.ParToDel(dt3.Rows[0][7].ToString()); PBPP.OBCFE = ParToDecimal.ParToDel(dt3.Rows[0][8].ToString()); PBPP.PBTravelE = ParToDecimal.ParToDel(dt3.Rows[0][9].ToString()); PBPP.PBRE = ParToDecimal.ParToDel(dt3.Rows[0][10].ToString()); PBPP.PBME = ParToDecimal.ParToDel(dt3.Rows[0][11].ToString()); PBPP.PBTrainE = ParToDecimal.ParToDel(dt3.Rows[0][12].ToString()); PBPP.OBRE = ParToDecimal.ParToDel(dt3.Rows[0][13].ToString()); PBPP.PBAE = ParToDecimal.ParToDel(dt3.Rows[0][14].ToString()); PBPP.LUMD = ParToDecimal.ParToDel(dt3.Rows[0][15].ToString()); PBPP.PBWE = ParToDecimal.ParToDel(dt3.Rows[0][16].ToString()); PBPP.PBOCE = ParToDecimal.ParToDel(dt3.Rows[0][17].ToString()); PBPP.OCASE = ParToDecimal.ParToDel(dt3.Rows[0][19].ToString()); PBPP.PBIDTitol = ParToDecimal.ParToDel(dt3.Rows[0][3].ToString()); PBPP.PBYear = dtime; PBPP.DepID = AreaDepID; BG_ProBasiPubPayManager.AddBG_ProBasiPubPay(PBPP); for (int i = 0; i < dt4.Rows.Count; i++) { if (string.IsNullOrEmpty(dt4.Rows[i][3].ToString())) { return; } BG_ProPay PP = new BG_ProPay(); PP.PPID = dt4.Rows[i][3].ToString().Trim(); PP.ProPA0M = ParToDecimal.ParToDel(dt4.Rows[i][4].ToString()); PP.ProPYear = dtime; PP.DepID = AreaDepID; BG_ProPayManager.AddBG_ProPay(PP); } X.Msg.Alert("提示", "导入成功.").Show(); }
public static BG_ProPay GetBG_ProPayByProPID(int proPID) { string sql = "SELECT * FROM BG_ProPay WHERE ProPID = @ProPID"; try { SqlParameter para = new SqlParameter("@ProPID", proPID); DataTable dt = DBUnity.AdapterToTab(sql, para); if(dt.Rows.Count > 0) { BG_ProPay bG_ProPay = new BG_ProPay(); bG_ProPay.ProPID = dt.Rows[0]["ProPID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["ProPID"]; bG_ProPay.DepID = dt.Rows[0]["DepID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DepID"]; bG_ProPay.ProPYear = dt.Rows[0]["ProPYear"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[0]["ProPYear"]; bG_ProPay.PPID = dt.Rows[0]["PPID"] == DBNull.Value ? "" : (string)dt.Rows[0]["PPID"]; bG_ProPay.ProPA0M = dt.Rows[0]["ProPA0M"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["ProPA0M"]; return bG_ProPay; } else { return null; } } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
public static bool DeleteBG_ProPay(BG_ProPay bG_ProPay) { return DeleteBG_ProPayByProPID( bG_ProPay.ProPID ); }
public static bool ModifyBG_ProPay(BG_ProPay bG_ProPay) { string sql = "UPDATE BG_ProPay " + "SET " + "DepID = @DepID, " + "ProPYear = @ProPYear, " + "PPID = @PPID, " + "ProPA0M = @ProPA0M " + "WHERE ProPID = @ProPID"; try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@ProPID", bG_ProPay.ProPID), new SqlParameter("@DepID", bG_ProPay.DepID), new SqlParameter("@ProPYear", bG_ProPay.ProPYear), new SqlParameter("@PPID", bG_ProPay.PPID), new SqlParameter("@ProPA0M", bG_ProPay.ProPA0M) }; int t = DBUnity.ExecuteNonQuery(CommandType.Text, sql, para); if(t>0) { return true; } else { return false; } } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
public static bool ModifyBG_ProPay(BG_ProPay bG_ProPay) { return BG_ProPayService.ModifyBG_ProPay(bG_ProPay); }
public static bool DeleteBG_ProPay(BG_ProPay bG_ProPay) { return BG_ProPayService.DeleteBG_ProPay(bG_ProPay); }
public static BG_ProPay AddBG_ProPay(BG_ProPay bG_ProPay) { return BG_ProPayService.AddBG_ProPay(bG_ProPay); }