public static To_Income getTo_IncomeBySql(string sql) { DataTable dt = DBHelper.GetDataSet(sql); To_Income model = null; if (dt.Rows.Count > 0) { model = new To_Income(); foreach (DataRow dr in dt.Rows) { model.ID = Convert.ToInt32(dr["Id"]); model.ComeDate = Convert.ToDateTime(dr["comeDate"]); model.ComeMoney = Convert.ToDouble(dr["comeMoney"]); model.ComeBankName = Convert.ToString(dr["comeBankName"]); model.ComeBankId = Convert.ToInt32(dr["comeBankId"]); model.ComeBankAccount = Convert.ToString(dr["comeBankAccount"]); model.ComeDepart = Convert.ToString(dr["comeDepart"]); model.ComeDepartId = Convert.ToInt32(dr["comeDepartId"]); model.MakeName = Convert.ToString(dr["makeName"]); model.MakeId = Convert.ToInt32(dr["makeId"]); model.MakeDate = Convert.ToDateTime(dr["makeDate"]); model.Remark = Convert.ToString(dr["remark"]); model.ComeUnit = Convert.ToString(dr["comeUnit"]); model.SKTypeId = Convert.ToInt32(dr["comeTypeid"]); model.SKType = Convert.ToString(dr["comeType"]); } } return(model); }
public static int Update(To_Income income) { string sql = "update To_Income set comeDate=@comeDate,comeMoney=@comeMoney,comeBankName=@comeBankName,comeBankId=@comeBankId,comeBankAccount=@comeBankAccount,comeDepart=@comeDepart,comeDepartId=@comeDepartId,makeName=@makeName,makeId=@makeId,remark=@remark,makeDate=@makeDate,comeUnit=@comeUnit,comeTypeid=@comeTypeid,comeType=@comeType where Id=@Id"; SqlParameter[] sp = new SqlParameter[] { new SqlParameter("@Id", income.ID), new SqlParameter("@comeDate", income.ComeDate), new SqlParameter("@comeMoney", income.ComeMoney), new SqlParameter("@comeBankName", income.ComeBankName), new SqlParameter("@comeBankId", income.ComeBankId), new SqlParameter("@comeBankAccount", income.ComeBankAccount), new SqlParameter("@comeDepart", income.ComeDepart), new SqlParameter("@comeDepartId", income.ComeDepartId), new SqlParameter("@makeName", income.MakeName), new SqlParameter("@makeId", income.MakeId), new SqlParameter("@remark", income.Remark), new SqlParameter("@makeDate", income.MakeDate), new SqlParameter("@comeUnit", income.ComeUnit), new SqlParameter("@comeTypeid", income.SKTypeId), new SqlParameter("@comeType", income.SKType) }; return(DBHelper.ExecuteCommand(sql, sp)); }
private int UpdateCollecting() { string id = Request.QueryString["id"]; To_Income income = To_IncomeManager.GetModel(id); income.ComeDate = DateTime.Parse(this.txtSKDate.Text.Trim()); income.ComeMoney = double.Parse(this.txtMoney.Text.Trim()); income.ComeBankName = this.ddlBank.SelectedItem.Text; income.ComeBankId = int.Parse(this.ddlBank.SelectedValue); income.ComeBankAccount = this.lblBankAccount.Text; income.ComeDepart = this.ddlDepart.SelectedItem.Text; //所属部门 income.ComeDepartId = int.Parse(ddlDepart.SelectedValue); //所属部门id income.Remark = this.txtMark.Value; //备注 income.ComeUnit = this.txtSKUnit.Text.Trim(); income.SKTypeId = Convert.ToInt32(ddlsktype.SelectedValue); income.SKType = ddlsktype.SelectedValue == "0" ? "" : ddlsktype.SelectedItem.Text; return(To_IncomeManager.Update(income)); }
private void Load_InitialData() { string id = Request.QueryString["id"]; if (!string.IsNullOrEmpty(id)) { To_Income income = To_IncomeManager.GetModel(id); this.lblIncomeDate.Text = income.ComeDate.ToString("yyyy-MM-dd"); this.lblIncomeMoney.Text = income.ComeMoney.ToString("0.00"); this.lblIncomeBankName.Text = income.ComeBankName; this.lblIncomeBankAccount.Text = income.ComeBankAccount; this.lblIncomeDepart.Text = income.ComeDepart; this.LtrMark.Text = income.Remark; this.lblmakeName.Text = income.MakeName; this.lblmakeDate.Text = income.MakeDate.ToString("yyyy-MM-dd"); this.lblIncomeUnit.Text = income.ComeUnit; this.lblSktype.Text = income.SKType; } }
/// <summary> /// 加载初始信息 /// </summary> private void Load_InitialData() { Load_Bank(); Load_Depart(); string id = Request.QueryString["id"]; if (!string.IsNullOrEmpty(id)) { To_Income income = To_IncomeManager.GetModel(id); this.txtSKDate.Text = income.ComeDate.ToString("yyyy-MM-dd"); this.txtMoney.Text = income.ComeMoney.ToString("0.00"); this.ddlBank.SelectedValue = income.ComeBankId.ToString(); this.lblBankAccount.Text = income.ComeBankAccount; this.ddlDepart.SelectedValue = income.ComeDepartId.ToString(); this.txtMark.Value = income.Remark; this.lblMaker.Text = income.MakeName; this.lblMakeDate.Text = income.MakeDate.ToString("yyyy-MM-dd"); this.txtSKUnit.Text = income.ComeUnit; this.ddlsktype.SelectedValue = income.SKTypeId.ToString(); } }
private int AddCollecting() { LoginInfo currentUser = Session["login"] as LoginInfo; To_Income income = new To_Income(); income.ComeDate = DateTime.Parse(this.txtSKDate.Text.Trim()); //收款日期 income.ComeMoney = double.Parse(this.txtMoney.Text.Trim()); //收款金额 income.ComeUnit = this.txtSKUnit.Text.Trim(); //付款单位 income.ComeBankName = this.ddlBank.SelectedItem.Text; //入账银行 income.ComeBankId = int.Parse(this.ddlBank.SelectedValue); //入账银行id income.ComeBankAccount = this.lblBankAccount.Text; //入账银行帐号 income.ComeDepart = this.ddlDepart.SelectedItem.Text; //所属部门 income.ComeDepartId = int.Parse(ddlDepart.SelectedValue); //所属部门id income.MakeName = currentUser.Cname; //制单员 income.MakeId = currentUser.Id; //制单员id income.Remark = this.txtMark.Value; //备注 income.MakeDate = DateTime.Parse(this.lblMakeDate.Text.Trim()); //制单日期 income.SKTypeId = Convert.ToInt32(ddlsktype.SelectedValue); income.SKType = ddlsktype.SelectedValue == "0" ? "" : ddlsktype.SelectedItem.Text; int result = To_IncomeManager.Add(income); return(result); }
public static int Add(To_Income income) { string sql = "insert into To_Income([comeDate],[comeMoney],[comeBankName],[comeBankId],[comeBankAccount],[comeDepart],[comeDepartId],[makeName],[makeId],[remark],[makeDate],[comeUnit],[comeTypeid],[comeType]) values (@comeDate,@comeMoney,@comeBankName,@comeBankId,@comeBankAccount,@comeDepart,@comeDepartId,@makeName,@makeId,@remark,@makeDate,@comeUnit,@comeTypeid,@comeType)"; SqlParameter[] sp = new SqlParameter[] { new SqlParameter("@comeDate", income.ComeDate), new SqlParameter("@comeMoney", income.ComeMoney), new SqlParameter("@comeBankName", income.ComeBankName), new SqlParameter("@comeBankId", income.ComeBankId), new SqlParameter("@comeBankAccount", income.ComeBankAccount), new SqlParameter("@comeDepart", income.ComeDepart), new SqlParameter("@comeDepartId", income.ComeDepartId), new SqlParameter("@makeName", income.MakeName), new SqlParameter("@makeId", income.MakeId), new SqlParameter("@remark", income.Remark), new SqlParameter("@makeDate", income.MakeDate), new SqlParameter("@comeUnit", income.ComeUnit), new SqlParameter("@comeTypeid", income.SKTypeId), new SqlParameter("@comeType", income.SKType) }; return(DBHelper.ExecuteCommand(sql, sp)); }
public static int Update(To_Income income) { return(To_IncomeService.Update(income)); }
/// <summary> /// 新增数据 /// </summary> /// <param name="income"></param> /// <returns></returns> public static int Add(To_Income income) { return(To_IncomeService.Add(income)); }
protected void RpList_ItemCommand(object source, RepeaterCommandEventArgs e) { //参数数组,0:单据ID,1:是否确认,2:制单员 string[] cmdArgs = e.CommandArgument.ToString().Split(','); string cmdName = e.CommandName; //表示单据是否已确认 bool confirmReceipt = false; bool ismaker = false; LoginInfo login = Session["login"] as LoginInfo; if (cmdArgs.Length > 1) { confirmReceipt = cmdArgs[1] == "1"; ismaker = cmdArgs[2] == login.Cname; } string msg = ""; switch (cmdName) { case "EDIT": if (confirmReceipt) { msg = "已确认单据不能修改"; break; } if (!ismaker) { msg = "不是本人所做的收款单不能修改"; break; } if (HttpContext.Current.Request.QueryString["page"] != null) { int page = int.Parse(HttpContext.Current.Request.QueryString["page"]); Server.Transfer(string.Format("CollectingEdit.aspx?pageindex=" + page + "&id={0}", cmdArgs[0])); } else { Server.Transfer(string.Format("CollectingEdit.aspx?id={0}", cmdArgs[0])); } break; case "search": if (AspNetPager1.CurrentPageIndex > 1) { int page = AspNetPager1.CurrentPageIndex; Response.Redirect("Collecting.aspx?pageindex=" + page + "&id=" + e.CommandArgument.ToString()); //参数sqsh判断当前所跳转到预览界面的是申请还是审核 } else { Response.Redirect("Collecting.aspx?id=" + e.CommandArgument.ToString()); } break; case "DELETE": if (confirmReceipt) { msg = "已确认单据不能删除"; break; } if (!ismaker) { msg = "不是本人所做的收款单不能删除"; break; } DeleteCollecting(int.Parse(cmdArgs[0])); break; case "CANCEL": To_ClaimManager claimBLL = new To_ClaimManager(); if (claimBLL.ExitsCollecting(int.Parse(cmdArgs[0]))) { msg = "该条收款记录已被认领,不能取消确认"; break; } To_CollectingManager.CancelConfirm(int.Parse(cmdArgs[0])); BindRpList(); break; case "confirm": To_CollectingManager.updateConfirm(cmdArgs[0], login.Cname, DateTime.Now.ToString()); BindRpList(); break; case "CHANGE": To_Income income = new To_Income(); DataTable mytable = To_CollectingManager.GetList(1, "id=" + cmdArgs[0], "id desc"); if (mytable != null) { income.ComeBankAccount = mytable.Rows[0]["payBankAcount"].ToString(); income.ComeBankId = int.Parse(mytable.Rows[0]["payBankId"].ToString()); income.ComeBankName = mytable.Rows[0]["payBank"].ToString(); income.ComeDate = DateTime.Parse(mytable.Rows[0]["receiptDate"].ToString()); income.ComeDepart = mytable.Rows[0]["markerDepartment"].ToString(); income.ComeDepartId = int.Parse(mytable.Rows[0]["markerDepartmentID"].ToString()); income.ComeMoney = double.Parse(mytable.Rows[0]["receiptAmount"].ToString()); income.ComeUnit = mytable.Rows[0]["paymentUnit"].ToString(); income.MakeDate = DateTime.Parse(mytable.Rows[0]["markDate"].ToString()); income.MakeId = int.Parse(mytable.Rows[0]["markerID"].ToString()); income.MakeName = mytable.Rows[0]["marker"].ToString(); income.Remark = mytable.Rows[0]["receiptMark"].ToString() + " 由原收款单号为" + mytable.Rows[0]["receiptNum"].ToString() + "转化而来"; income.SKType = ""; income.SKTypeId = 0; if (To_IncomeManager.Add(income) > 0) { msg = "该条收款记录已成功转化为其他收款"; To_CollectingManager.deleteTo_Collecting(int.Parse(cmdArgs[0])); //转化完成之后对起进行删除 } } BindRpList(); break; default: break; } if (msg != string.Empty) { ClientScript.RegisterClientScriptBlock(this.GetType(), "page", string.Format("alert('{0}');", msg), true); } }