/// <summary> /// 添加一条报销申请信息 /// </summary> /// <param name="ar">报销申请信息</param> /// <returns>bool</returns> public static int AddApplyReimbur(BG_ApplyReimbur ar) { int reIdentity = 0; try { string sqlStr = @"insert into BG_ApplyReimbur(ARTime,DepID,ARReiSinNum,ARExpType,PPID,ARRepDep,ARAgent,ARMon,ARExcu,ARListSta) values(@ARTime,@DepID,@ARReiSinNum,@ARExpType,@PPID,@ARRepDep,@ARAgent,@ARMon,@ARExcu,@ARListSta);select IDENT_CURRENT('BG_ApplyReimbur')";//select @@identity; SqlParameter[] Pars = { new SqlParameter("@ARTime",ar.ARTime), new SqlParameter("@DepID",ar.DepID), new SqlParameter("@ARReiSinNum",ar.ARReiSinNum), new SqlParameter("@ARExpType",ar.ARExpType), //new SqlParameter("@ARExpPro",ar.ARExpPro), new SqlParameter("@PPID",ar.PPID), new SqlParameter("@ARRepDep",ar.ARRepDep), new SqlParameter("@ARAgent",ar.ARAgent), new SqlParameter("@ARMon",ar.ARMon), new SqlParameter("@ARExcu",ar.ARExcu), new SqlParameter("@ARListSta",ar.ARListSta) }; //falg = DBUnity.ExecuteNonQuery(CommandType.Text, sqlStr, Pars) > 0; string iden = DBUnity.ExecuteScalar(CommandType.Text, sqlStr, Pars); reIdentity = Utils.IntSafeConvert(iden); } catch (Exception ex) { reIdentity = 0; Log.WriteLog(ex.Message, "BudgetSys.DAL.BGApplyReimburService.AddApplyReimbur"); } return reIdentity; }
protected void btnAlter_Click(object sender, EventArgs e) { BG_ApplyReimbur bt = new BG_ApplyReimbur(); bt.ARID = Utils.IntSafeConvert(arid); bt.ARAgent = txtARAgent.Text.Trim(); //经办人 bt.ARExcu = txtARExcu.Text.Trim(); //事由 bt.PPID = Utils.IntSafeConvert(Session["PIID"]); //支出项目ID //bt.ARExpType = ddlARExpType.SelectedValue; //支出类型 bt.ARListSta = "未提交"; //申请表状态 bt.ARMon = decimal.Parse(txtARMon.Text.Trim()); //金额 bt.ARReiSinNum = txtARReiSinNum.Text.Trim(); //报销单号 bt.ARRepDep = txtARRepDep.Text.Trim(); //上报部门 bt.ARTime = DateTime.Parse(txtBITime.Text.Trim()); //申请时间 bt.DepID = DepID; //部门 BGApplyReimburManager.UpdApplyReimbur(bt); string message = "修改成功!"; Response.Write("<script language=javascript>alert(\"" + message.Trim() + "\");window.top.close();</script>"); //Response.Redirect("ApplyList.aspx", true); btnAlter.Enabled = true; }
public static BG_ApplyReimbur AddBG_ApplyReimbur(BG_ApplyReimbur bG_ApplyReimbur) { string sql = "INSERT BG_ApplyReimbur (DepID, ARTime, ARReiSinNum, PPID, ARExpType, ARRepDep, ARAgent, ARMon, ARExcu, ARListSta, ARReason)" + "VALUES (@DepID, @ARTime, @ARReiSinNum, @PPID, @ARExpType, @ARRepDep, @ARAgent, @ARMon, @ARExcu, @ARListSta, @ARReason)"; sql += " ; SELECT @@IDENTITY"; try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@DepID", bG_ApplyReimbur.DepID), new SqlParameter("@ARTime", bG_ApplyReimbur.ARTime), new SqlParameter("@ARReiSinNum", bG_ApplyReimbur.ARReiSinNum), new SqlParameter("@PPID", bG_ApplyReimbur.PPID), new SqlParameter("@ARExpType", bG_ApplyReimbur.ARExpType), new SqlParameter("@ARRepDep", bG_ApplyReimbur.ARRepDep), new SqlParameter("@ARAgent", bG_ApplyReimbur.ARAgent), new SqlParameter("@ARMon", bG_ApplyReimbur.ARMon), new SqlParameter("@ARExcu", bG_ApplyReimbur.ARExcu), new SqlParameter("@ARListSta", bG_ApplyReimbur.ARListSta), new SqlParameter("@ARReason", bG_ApplyReimbur.ARReason) }; string IdStr = DBUnity.ExecuteScalar(CommandType.Text, sql, para); int newId = Convert.ToInt32(IdStr); return GetBG_ApplyReimburByARID(newId); } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
/// <summary> /// 修改指定报销申请信息 /// </summary> /// <param name="ar">报销申请信息</param> /// <returns>bool</returns> public static bool UpdApplyReimbur(BG_ApplyReimbur ar) { bool flag = false; try { string sqlStr = @"update BG_ApplyReimbur set DepID=@DepID, ARTime=@ARTime,ARReiSinNum=@ARReiSinNum,ARExpType=@ARExpType, PPID=@PPID,ARRepDep=@ARRepDep,ARAgent=@ARAgent,ARMon=@ARMon,ARExcu=@ARExcu,ARListSta=@ARListSta where ARID=@ARID"; SqlParameter[] Pars = new SqlParameter[]{ new SqlParameter("@ARID",ar.ARID), new SqlParameter("@DepID",ar.DepID), new SqlParameter("@ARTime",ar.ARTime), new SqlParameter("@ARReiSinNum",ar.ARReiSinNum), new SqlParameter("@ARExpType",ar.ARExpType), new SqlParameter("@PPID",ar.PPID), new SqlParameter("@ARRepDep",ar.ARRepDep), new SqlParameter("@ARAgent",ar.ARAgent), new SqlParameter("@ARMon",ar.ARMon), new SqlParameter("@ARExcu",ar.ARExcu), new SqlParameter("@ARListSta",ar.ARListSta) }; flag = DBUnity.ExecuteNonQuery(CommandType.Text, sqlStr, Pars) > 0; } catch (Exception ex) { flag = false; Log.WriteLog(ex.Message, "BudgetSys.DAL.BGApplyReimburService.UpdApplyReimbur"); } return flag; }
public static bool DeleteBG_ApplyReimbur(BG_ApplyReimbur bG_ApplyReimbur) { return DeleteBG_ApplyReimburByARID( bG_ApplyReimbur.ARID ); }
public static bool ModifyBG_ApplyReimbur(BG_ApplyReimbur bG_ApplyReimbur) { string sql = "UPDATE BG_ApplyReimbur " + "SET " + "DepID = @DepID, " + "ARTime = @ARTime, " + "ARReiSinNum = @ARReiSinNum, " + "PPID = @PPID, " + "ARExpType = @ARExpType, " + "ARRepDep = @ARRepDep, " + "ARAgent = @ARAgent, " + "ARMon = @ARMon, " + "ARExcu = @ARExcu, " + "ARListSta = @ARListSta, " + "ARReason = @ARReason " + "WHERE ARID = @ARID"; try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@ARID", bG_ApplyReimbur.ARID), new SqlParameter("@DepID", bG_ApplyReimbur.DepID), new SqlParameter("@ARTime", bG_ApplyReimbur.ARTime), new SqlParameter("@ARReiSinNum", bG_ApplyReimbur.ARReiSinNum), new SqlParameter("@PPID", bG_ApplyReimbur.PPID), new SqlParameter("@ARExpType", bG_ApplyReimbur.ARExpType), new SqlParameter("@ARRepDep", bG_ApplyReimbur.ARRepDep), new SqlParameter("@ARAgent", bG_ApplyReimbur.ARAgent), new SqlParameter("@ARMon", bG_ApplyReimbur.ARMon), new SqlParameter("@ARExcu", bG_ApplyReimbur.ARExcu), new SqlParameter("@ARListSta", bG_ApplyReimbur.ARListSta), new SqlParameter("@ARReason", bG_ApplyReimbur.ARReason) }; 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 BG_ApplyReimbur GetBG_ApplyReimburByARID(int aRID) { string sql = "SELECT * FROM BG_ApplyReimbur WHERE ARID = @ARID"; try { SqlParameter para = new SqlParameter("@ARID", aRID); DataTable dt = DBUnity.AdapterToTab(sql, para); if(dt.Rows.Count > 0) { BG_ApplyReimbur bG_ApplyReimbur = new BG_ApplyReimbur(); bG_ApplyReimbur.ARID = dt.Rows[0]["ARID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["ARID"]; bG_ApplyReimbur.DepID = dt.Rows[0]["DepID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DepID"]; bG_ApplyReimbur.ARTime = dt.Rows[0]["ARTime"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[0]["ARTime"]; bG_ApplyReimbur.ARReiSinNum = dt.Rows[0]["ARReiSinNum"] == DBNull.Value ? "" : (string)dt.Rows[0]["ARReiSinNum"]; bG_ApplyReimbur.PPID = dt.Rows[0]["PPID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PPID"]; bG_ApplyReimbur.ARExpType = dt.Rows[0]["ARExpType"] == DBNull.Value ? "" : (string)dt.Rows[0]["ARExpType"]; bG_ApplyReimbur.ARRepDep = dt.Rows[0]["ARRepDep"] == DBNull.Value ? "" : (string)dt.Rows[0]["ARRepDep"]; bG_ApplyReimbur.ARAgent = dt.Rows[0]["ARAgent"] == DBNull.Value ? "" : (string)dt.Rows[0]["ARAgent"]; bG_ApplyReimbur.ARMon = dt.Rows[0]["ARMon"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["ARMon"]; bG_ApplyReimbur.ARExcu = dt.Rows[0]["ARExcu"] == DBNull.Value ? "" : (string)dt.Rows[0]["ARExcu"]; bG_ApplyReimbur.ARListSta = dt.Rows[0]["ARListSta"] == DBNull.Value ? "" : (string)dt.Rows[0]["ARListSta"]; bG_ApplyReimbur.ARReason = dt.Rows[0]["ARReason"] == DBNull.Value ? "" : (string)dt.Rows[0]["ARReason"]; return bG_ApplyReimbur; } else { return null; } } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
public static bool ModifyBG_ApplyReimbur(BG_ApplyReimbur bG_ApplyReimbur) { return BG_ApplyReimburService.ModifyBG_ApplyReimbur(bG_ApplyReimbur); }
public static bool DeleteBG_ApplyReimbur(BG_ApplyReimbur bG_ApplyReimbur) { return BG_ApplyReimburService.DeleteBG_ApplyReimbur(bG_ApplyReimbur); }
public static BG_ApplyReimbur AddBG_ApplyReimbur(BG_ApplyReimbur bG_ApplyReimbur) { return BG_ApplyReimburService.AddBG_ApplyReimbur(bG_ApplyReimbur); }
/// <summary> /// 添加一条报销申请信息 /// </summary> /// <param name="arid">报销申请信息</param> /// <returns>bool</returns> public static int AddApplyReimbur(BG_ApplyReimbur ar) { return BGApplyReimburService.AddApplyReimbur(ar); }
/// <summary> /// 修改指定报销申请信息 /// </summary> /// <param name="arid">报销申请信息</param> /// <returns>bool</returns> public static bool UpdApplyReimbur(BG_ApplyReimbur ar) { return BGApplyReimburService.UpdApplyReimbur(ar); }