public static BG_ReimAppendix AddBG_ReimAppendix(BG_ReimAppendix bG_ReimAppendix) { string sql = "INSERT BG_ReimAppendix (ARID, ARType, ARName, ARContent, ARTime)" + "VALUES (@ARID, @ARType, @ARName, @ARContent, @ARTime)"; sql += " ; SELECT @@IDENTITY"; try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@ARID", bG_ReimAppendix.ARID), new SqlParameter("@ARType", bG_ReimAppendix.ARType), new SqlParameter("@ARName", bG_ReimAppendix.ARName), new SqlParameter("@ARContent", bG_ReimAppendix.ARContent), new SqlParameter("@ARTime", bG_ReimAppendix.ARTime) }; string IdStr = DBUnity.ExecuteScalar(CommandType.Text, sql, para); int newId = Convert.ToInt32(IdStr); return(GetBG_ReimAppendixByRADID(newId)); } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
protected void btnAlter_Click(object sender, EventArgs e) { BG_ReimAppendix ra = BGReimAppendixManager.GetAcc(arid); string[] str = ra.ARContent.Split('☆'); ra.ARContent = getCbCatalog(); ra.ARTime = Convert.ToDateTime(Session["time"]); if (BGReimAppendixManager.UpdAccessories(ra)) { lblMResult.Text = "* 修改成功"; Response.Redirect("ApplyAlter.aspx?arid=" + arid, true); } else { lblMResult.Text = "* 操作失败、请检查数据后重试"; } //if (total > Convert.ToDecimal(str[8])) //{ // lblMResult.Text = "* 所填金额不能大于分配金额"; // return; //} //else //{ // ra.ARContent = getCbCatalog(); // if (BGReimAppendixManager.UpdAccessories(ra)) // { // lblMResult.Text = "* 修改成功"; // Response.Redirect("ApplyAlter.aspx?arid=" + arid, true); // } // else // { // lblMResult.Text = "* 操作失败、请检查数据后重试"; // } //} }
public static BG_ReimAppendix GetBG_ReimAppendixByRADID(int rADID) { string sql = "SELECT * FROM BG_ReimAppendix WHERE RADID = @RADID"; try { SqlParameter para = new SqlParameter("@RADID", rADID); DataTable dt = DBUnity.AdapterToTab(sql, para); if (dt.Rows.Count > 0) { BG_ReimAppendix bG_ReimAppendix = new BG_ReimAppendix(); bG_ReimAppendix.RADID = dt.Rows[0]["RADID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["RADID"]; bG_ReimAppendix.ARID = dt.Rows[0]["ARID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["ARID"]; bG_ReimAppendix.ARType = dt.Rows[0]["ARType"] == DBNull.Value ? "" : (string)dt.Rows[0]["ARType"]; bG_ReimAppendix.ARName = dt.Rows[0]["ARName"] == DBNull.Value ? "" : (string)dt.Rows[0]["ARName"]; bG_ReimAppendix.ARContent = dt.Rows[0]["ARContent"] == DBNull.Value ? "" : (string)dt.Rows[0]["ARContent"]; bG_ReimAppendix.ARTime = dt.Rows[0]["ARTime"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[0]["ARTime"]; return(bG_ReimAppendix); } else { return(null); } } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
protected void btnAlter_Click(object sender, EventArgs e) { BG_ReimAppendix ra = BGReimAppendixManager.GetAcc(arid); ra.ARContent = getCbCatalog(); ra.ARTime = Convert.ToDateTime(Session["time"]); if (BGReimAppendixManager.UpdAccessories(ra)) { lblMResult.Text = "* 修改成功"; Response.Redirect("ApplyAlter.aspx?arid=" + arid, true); } else { lblMResult.Text = "* 操作失败、请检查数据后重试"; } }
protected void btnAdd_Click(object sender, EventArgs e) { BG_ReimAppendix ra = new BG_ReimAppendix(); ra.ARID = common.IntSafeConvert(arid); ra.ARContent = getCbCatalog(); ra.ARType = "培训"; ra.ARTime = Convert.ToDateTime(Session["time"]); if (BGReimAppendixManager.AddAccessories(ra)) { lblMResult.Text = "* 其它费用"; } else { lblMResult.Text = "* 操作失败、请检查数据后重试"; } }
public static bool ModifyBG_ReimAppendix(BG_ReimAppendix bG_ReimAppendix) { string sql = "UPDATE BG_ReimAppendix " + "SET " + "ARID = @ARID, " + "ARType = @ARType, " + "ARName = @ARName, " + "ARContent = @ARContent, " + "ARTime = @ARTime " + "WHERE RADID = @RADID"; try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@RADID", bG_ReimAppendix.RADID), new SqlParameter("@ARID", bG_ReimAppendix.ARID), new SqlParameter("@ARType", bG_ReimAppendix.ARType), new SqlParameter("@ARName", bG_ReimAppendix.ARName), new SqlParameter("@ARContent", bG_ReimAppendix.ARContent), new SqlParameter("@ARTime", bG_ReimAppendix.ARTime) }; 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 btnAdd_Click(object sender, EventArgs e) { BG_ReimAppendix ra = new BG_ReimAppendix(); ra.ARID = common.IntSafeConvert(arid); ra.ARContent = getCbCatalog(); ra.ARType = "资料印制"; ra.ARTime = Convert.ToDateTime(Session["time"]); string[] str = ra.ARContent.Split('☆'); decimal total = ParToDecimal.ParToDel(Session["money"].ToString()); if (BGReimAppendixManager.AddAccessories(ra)) { lblMResult.Text = "* 添加成功"; } else { lblMResult.Text = "* 操作失败、请检查数据后重试"; } //if (total > Convert.ToDecimal(str[32])) //{ // lblMResult.Text = "* 所填金额不能大于分配金额"; // return; //} //else //{ // if (BGReimAppendixManager.AddAccessories(ra)) // { // lblMResult.Text = "* 添加成功"; // } // else // { // lblMResult.Text = "* 操作失败、请检查数据后重试"; // } //} }
/// <summary> /// 添加一条附件信息 /// </summary> /// <param name="radid">附件</param> /// <returns>bool</returns> public static bool AddAccessories(BG_ReimAppendix radid) { bool falg = false; try { string sqlStr = @"insert into BG_ReimAppendix(ARID,ARType,ARName,ARContent,ARTime) values(@ARID,@ARType,@ARName,@ARContent,@ARTime)"; SqlParameter[] Pars = new SqlParameter[] { new SqlParameter("@ARID", radid.ARID), new SqlParameter("@ARType", radid.ARType), new SqlParameter("@ARName", radid.ARName), new SqlParameter("@ARContent", radid.ARContent), new SqlParameter("@ARTime", radid.ARTime) }; falg = DBUnity.ExecuteNonQuery(CommandType.Text, sqlStr, Pars) > 0; } catch { } return(falg); }
/// <summary> /// 修改指定报销附件信息 /// </summary> /// <param name="radid">附件信息</param> /// <returns>bool</returns> public static bool UpdAccessories(BG_ReimAppendix radid) { bool flag = false; try { string sqlStr = @"update BG_ReimAppendix set ARID=@ARID,ARType=@ARType,ARName=@ARName,ARContent=@ARContent,ARTime=@ARTime where RADID = @RADID"; SqlParameter[] Pars = new SqlParameter[] { new SqlParameter("@RADID", radid.RADID), new SqlParameter("@ARID", radid.ARID), new SqlParameter("@ARType", radid.ARType), new SqlParameter("@ARName", radid.ARName), new SqlParameter("@ARContent", radid.ARContent), new SqlParameter("@ARTime", radid.ARTime) }; flag = DBUnity.ExecuteNonQuery(CommandType.Text, sqlStr, Pars) > 0; } catch { } return(flag); }
protected void btnAdd_Click(object sender, EventArgs e) { BG_ReimAppendix ra = new BG_ReimAppendix(); ra.ARID = common.IntSafeConvert(arid); ra.ARContent = getCbCatalog(); ra.ARType = "工作会议"; string[] str = ra.ARContent.Split('☆'); ra.ARTime = Convert.ToDateTime(Session["time"]); //decimal total = Convert.ToDecimal(ChineseToNumber.WordToNumber(TextBox9.Text.Trim())); if (BGReimAppendixManager.AddAccessories(ra)) { lblMResult.Text = "* 添加成功"; } else { lblMResult.Text = "* 操作失败、请检查数据后重试"; } //if (total > Convert.ToDecimal(str[8])) //{ // lblMResult.Text = "* 所填金额不能大于分配金额"; // return; //} //else //{ // if (BGReimAppendixManager.AddAccessories(ra)) // { // lblMResult.Text = "* 添加成功"; // } // else // { // lblMResult.Text = "* 操作失败、请检查数据后重试"; // } //} }
/// <summary> /// 查询一条指定附件信息 /// </summary> /// <param name="arid">附件信息ID</param> /// <returns>BG_ReimAppendix</returns> public static BG_ReimAppendix GetAcc(string arid) { BG_ReimAppendix rm = new BG_ReimAppendix(); try { string sqlStr = "select * from BG_ReimAppendix where ARID={0} "; sqlStr = string.Format(sqlStr, arid); DataTable dt = DBUnity.AdapterToTab(sqlStr); if (dt.Rows.Count > 0) { rm.RADID = common.IntSafeConvert(dt.Rows[0]["RADID"]); rm.ARID = common.IntSafeConvert(dt.Rows[0]["ARID"]); rm.ARType = dt.Rows[0]["ARType"].ToString(); rm.ARTime = DateTime.Parse(dt.Rows[0]["ARTime"].ToString()); rm.ARContent = dt.Rows[0]["ARContent"].ToString(); } } catch { } return(rm); }
public static bool DeleteBG_ReimAppendix(BG_ReimAppendix bG_ReimAppendix) { return(DeleteBG_ReimAppendixByRADID(bG_ReimAppendix.RADID)); }
/// <summary> /// 修改指定报销附件信息 /// </summary> /// <param name="radid">附件信息</param> /// <returns>bool</returns> public static bool UpdAccessories(BG_ReimAppendix radid) { return(BGReimAppendixService.UpdAccessories(radid)); }
public static bool ModifyBG_ReimAppendix(BG_ReimAppendix bG_ReimAppendix) { return(BG_ReimAppendixService.ModifyBG_ReimAppendix(bG_ReimAppendix)); }
public static bool DeleteBG_ReimAppendix(BG_ReimAppendix bG_ReimAppendix) { return(BG_ReimAppendixService.DeleteBG_ReimAppendix(bG_ReimAppendix)); }
public static BG_ReimAppendix AddBG_ReimAppendix(BG_ReimAppendix bG_ReimAppendix) { return(BG_ReimAppendixService.AddBG_ReimAppendix(bG_ReimAppendix)); }