public static BG_MonPayPlanRemark AddBG_MonPayPlanRemark(BG_MonPayPlanRemark bG_MonPayPlanRemark) { string sql = "INSERT BG_MonPayPlanRemark (DeptID, MATime, MASta, MACause, MAUser, MATimes)" + "VALUES (@DeptID, @MATime, @MASta, @MACause, @MAUser, @MATimes)"; sql += " ; SELECT @@IDENTITY"; try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@DeptID", bG_MonPayPlanRemark.DeptID), new SqlParameter("@MATime", bG_MonPayPlanRemark.MATime), new SqlParameter("@MASta", bG_MonPayPlanRemark.MASta), new SqlParameter("@MACause", bG_MonPayPlanRemark.MACause), new SqlParameter("@MAUser", bG_MonPayPlanRemark.MAUser), new SqlParameter("@MATimes", bG_MonPayPlanRemark.MATimes) }; string IdStr = DBUnity.ExecuteScalar(CommandType.Text, sql, para); int newId = Convert.ToInt32(IdStr); return GetBG_MonPayPlanRemarkByPRID(newId); } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
public static bool ModifyBG_MonPayPlanRemark(BG_MonPayPlanRemark bG_MonPayPlanRemark) { return BG_MonPayPlanRemarkService.ModifyBG_MonPayPlanRemark(bG_MonPayPlanRemark); }
public static bool DeleteBG_MonPayPlanRemark(BG_MonPayPlanRemark bG_MonPayPlanRemark) { return BG_MonPayPlanRemarkService.DeleteBG_MonPayPlanRemark(bG_MonPayPlanRemark); }
public static BG_MonPayPlanRemark AddBG_MonPayPlanRemark(BG_MonPayPlanRemark bG_MonPayPlanRemark) { return BG_MonPayPlanRemarkService.AddBG_MonPayPlanRemark(bG_MonPayPlanRemark); }
public static BG_MonPayPlanRemark GetBG_MonPayPlanRemarkByPRID(int pRID) { string sql = "SELECT * FROM BG_MonPayPlanRemark WHERE PRID = @PRID"; try { SqlParameter para = new SqlParameter("@PRID", pRID); DataTable dt = DBUnity.AdapterToTab(sql, para); if(dt.Rows.Count > 0) { BG_MonPayPlanRemark bG_MonPayPlanRemark = new BG_MonPayPlanRemark(); bG_MonPayPlanRemark.PRID = dt.Rows[0]["PRID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PRID"]; bG_MonPayPlanRemark.DeptID = dt.Rows[0]["DeptID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DeptID"]; bG_MonPayPlanRemark.MATime = dt.Rows[0]["MATime"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[0]["MATime"]; bG_MonPayPlanRemark.MASta = dt.Rows[0]["MASta"] == DBNull.Value ? "" : (string)dt.Rows[0]["MASta"]; bG_MonPayPlanRemark.MACause = dt.Rows[0]["MACause"] == DBNull.Value ? "" : (string)dt.Rows[0]["MACause"]; bG_MonPayPlanRemark.MAUser = dt.Rows[0]["MAUser"] == DBNull.Value ? "" : (string)dt.Rows[0]["MAUser"]; bG_MonPayPlanRemark.MATimes = dt.Rows[0]["MATimes"] == DBNull.Value ? 0 : (int)dt.Rows[0]["MATimes"]; return bG_MonPayPlanRemark; } else { return null; } } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
public static bool DeleteBG_MonPayPlanRemark(BG_MonPayPlanRemark bG_MonPayPlanRemark) { return DeleteBG_MonPayPlanRemarkByPRID( bG_MonPayPlanRemark.PRID ); }
public static bool ModifyBG_MonPayPlanRemark(BG_MonPayPlanRemark bG_MonPayPlanRemark) { string sql = "UPDATE BG_MonPayPlanRemark " + "SET " + "DeptID = @DeptID, " + "MATime = @MATime, " + "MASta = @MASta, " + "MACause = @MACause, " + "MAUser = @MAUser, " + "MATimes = @MATimes " + "WHERE PRID = @PRID"; try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@PRID", bG_MonPayPlanRemark.PRID), new SqlParameter("@DeptID", bG_MonPayPlanRemark.DeptID), new SqlParameter("@MATime", bG_MonPayPlanRemark.MATime), new SqlParameter("@MASta", bG_MonPayPlanRemark.MASta), new SqlParameter("@MACause", bG_MonPayPlanRemark.MACause), new SqlParameter("@MAUser", bG_MonPayPlanRemark.MAUser), new SqlParameter("@MATimes", bG_MonPayPlanRemark.MATimes) }; 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; } }
protected void btnsubmit_DirectClick(object sender, DirectEventArgs e) { string pici = cmbpici.SelectedItem.Value; string pici1 = cmbpici.RawValue.ToString(); string pici2 = cmbpici.SelectedItem.Text; pici = pici1 == pici2 ? pici1 : pici2; if (hidflag.Text != "2") { decimal sq = BG_MonPayPlanGenerateLogic.GetsqMon(CurrentYear + "-" + cmbmon.SelectedItem.Value, DepID, common.IntSafeConvert(pici)); if (sq <= 0) { X.Msg.Alert("申请月度用款计划", "无法提交,请先填写数据.").Show(); return; } } string yearMonth = CurrentYear + "-" + cmbmon.SelectedItem.Value; int PRID = BG_MonPayPlanGenerateLogic.GetSubmitMonPayremarkID(yearMonth, DepID, common.IntSafeConvert(pici)); if (PRID > 0) { BG_MonPayPlanRemark mppr = BG_MonPayPlanRemarkManager.GetBG_MonPayPlanRemarkByPRID(PRID); mppr.DeptID = DepID; mppr.MACause = ""; mppr.MASta = "未提交"; mppr.MATime = Convert.ToDateTime(CurrentYear + "-" + cmbmon.SelectedItem.Value + "-01"); mppr.MAUser = UserName; mppr.MATimes = common.IntSafeConvert(cmbpici.SelectedItem.Value); BG_MonPayPlanRemarkManager.ModifyBG_MonPayPlanRemark(mppr); X.Msg.Alert("申请月度用款计划", cmbmon.SelectedItem.Value + "月份用款计划已提交给财务科,请等待审核").Show(); btnsubmit.Hidden = true; hidflag.Text = "1"; Getmonth(); Session["NodeBC59"] = 1; } else { BG_MonPayPlanRemark mppr = new BG_MonPayPlanRemark(); mppr.DeptID = DepID; mppr.MACause = ""; mppr.MASta = "未提交"; mppr.MATime = Convert.ToDateTime(CurrentYear + "-" + cmbmon.SelectedItem.Value + "-01"); mppr.MAUser = UserName; mppr.MATimes = common.IntSafeConvert(cmbpici.SelectedItem.Value); BG_MonPayPlanRemarkManager.AddBG_MonPayPlanRemark(mppr); X.Msg.Alert("申请月度用款计划", cmbmon.SelectedItem.Value + "月份用款计划已提交财务科,请等待审核").Show(); btnsubmit.Hidden = true; hidflag.Text = "1"; Session["NodeBC59"] = 1; Getmonth(); } cmbpici.SelectedItem.Value = MATimesBind().ToString(); }