protected void btnSave_Click(object sender, EventArgs e) { StringBuilder stringBuilder = new StringBuilder(); RequestPayMainModel model = this.getModel(); this.detailBill.Delete(model.RPayMainID); if (!(base.Request.QueryString["action"].ToString() == "add")) { this.mainBll.Update(model); this.SavePlanDetails(); stringBuilder.Append("alert('系统提示:\\n\\n保存成功!');"); stringBuilder.Append("winclose('RequestPaymentEdit', 'RequestPayment.aspx?prjGuid=" + base.Request.QueryString["prjId"].ToString() + "', true)"); base.RegisterScript(stringBuilder.ToString()); return; } if (this.mainBll.Exists(model.RPayCode)) { stringBuilder.Append("alert('系统提示:\\n\\n请款单号重复!');"); base.RegisterScript(stringBuilder.ToString()); return; } this.mainBll.Add(model); this.SavePlanDetails(); stringBuilder.Append("alert('系统提示:\\n\\n保存成功!');"); stringBuilder.Append("winclose('RequestPaymentEdit', 'RequestPayment.aspx?prjGuid=" + base.Request.QueryString["prjId"].ToString() + "', true)"); base.RegisterScript(stringBuilder.ToString()); }
public List <RequestPayMainModel> DataTableToList(DataTable dt) { List <RequestPayMainModel> list = new List <RequestPayMainModel>(); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { RequestPayMainModel item = new RequestPayMainModel(); if (dt.Rows[i]["RPayMainID"].ToString() != "") { item.RPayMainID = new Guid(dt.Rows[i]["RPayMainID"].ToString()); } item.RPayCode = dt.Rows[i]["RPayCode"].ToString(); if (dt.Rows[i]["PrjGuid"].ToString() != "") { item.PrjGuid = new Guid(dt.Rows[i]["PrjGuid"].ToString()); } if (dt.Rows[i]["FlowState"].ToString() != "") { item.FlowState = new int?(int.Parse(dt.Rows[i]["FlowState"].ToString())); } item.RPayUserCode = dt.Rows[i]["RPayUserCode"].ToString(); if (dt.Rows[i]["RPayDate"].ToString() != "") { item.RPayDate = new DateTime?(DateTime.Parse(dt.Rows[i]["RPayDate"].ToString())); } item.ReMark = dt.Rows[i]["ReMark"].ToString(); list.Add(item); } } return(list); }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(base.Request["ic"])) { this.ic = base.Request["ic"]; this.hdnCode.Value = base.Request.QueryString["ic"].ToString(); } this.mainModel = this.mainBll.GetModel(new Guid(this.hdnCode.Value.ToString())); this.lblExplain.Text = this.mainModel.ReMark.ToString(); this.lbluser.Text = PageHelper.QueryUser(this, this.mainModel.RPayUserCode); this.lblcode.Text = this.mainModel.RPayCode.ToString(); this.DateInTime.Text = Convert.ToDateTime(this.mainModel.RPayDate).ToShortDateString(); if (!string.IsNullOrEmpty(this.mainModel.PrjGuid.ToString())) { PrjInfoModel modelByPrjGuid = this.ptPrjInfo.GetModelByPrjGuid(this.mainModel.PrjGuid.ToString()); if (modelByPrjGuid != null) { this.lblProject.Text = modelByPrjGuid.PrjName; } } DataTable list = this.detailBll.GetList(" RpayMainId='" + this.mainModel.RPayMainID + "'"); this.gvwPlan.DataSource = list; this.gvwPlan.DataBind(); this.flAnnx.MID = 1023; this.flAnnx.FID = this.ic; this.flAnnx.Type = 1; this.lblPrintDate.Text = DateTime.Now.ToShortDateString(); this.lblPrintPeople.Text = PageHelper.QueryUser(this, base.UserCode); }
protected RequestPayMainModel getModel() { this.mainModel = new RequestPayMainModel(); this.mainModel.RPayMainID = new Guid(this.hdnCode.Value.ToString()); this.mainModel.RPayCode = this.txtRPayCode.Text.ToString(); this.mainModel.PrjGuid = new Guid(base.Request.QueryString["prjId"].ToString()); this.mainModel.RPayDate = new DateTime?(Convert.ToDateTime(this.DateInTime.Text.ToString())); this.mainModel.ReMark = this.txtExplain.Text.ToString(); this.mainModel.RPayUserCode = this.hdnPerson.Value.ToString(); if (base.Request.QueryString["action"].ToString() == "add") { this.mainModel.FlowState = new int?(-1); } return(this.mainModel); }
public bool Add(RequestPayMainModel model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into Fund_RequestPay_Main("); builder.Append("RPayMainID,RPayCode,PrjGuid,FlowState,RPayUserCode,RPayDate,ReMark)"); builder.Append(" values ("); builder.Append("@RPayMainID,@RPayCode,@PrjGuid,@FlowState,@RPayUserCode,@RPayDate,@ReMark)"); SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@RPayMainID", SqlDbType.UniqueIdentifier, 0x10), new SqlParameter("@RPayCode", SqlDbType.VarChar, 50), new SqlParameter("@PrjGuid", SqlDbType.UniqueIdentifier, 0x10), new SqlParameter("@FlowState", SqlDbType.Int, 4), new SqlParameter("@RPayUserCode", SqlDbType.VarChar, 8), new SqlParameter("@RPayDate", SqlDbType.DateTime), new SqlParameter("@ReMark", SqlDbType.VarChar, 100) }; commandParameters[0].Value = model.RPayMainID; commandParameters[1].Value = model.RPayCode; commandParameters[2].Value = model.PrjGuid; commandParameters[3].Value = model.FlowState; commandParameters[4].Value = model.RPayUserCode; commandParameters[5].Value = model.RPayDate; commandParameters[6].Value = model.ReMark; return(SqlHelper.ExecuteNonQuery(CommandType.Text, builder.ToString(), commandParameters) > 0); }
public bool Update(RequestPayMainModel model) { StringBuilder builder = new StringBuilder(); builder.Append("update Fund_RequestPay_Main set "); builder.Append("RPayCode=@RPayCode,"); builder.Append("PrjGuid=@PrjGuid,"); builder.Append("RPayUserCode=@RPayUserCode,"); builder.Append("RPayDate=@RPayDate,"); builder.Append("ReMark=@ReMark"); builder.Append(" where RPayMainID=@RPayMainID "); SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@RPayMainID", SqlDbType.UniqueIdentifier, 0x10), new SqlParameter("@RPayCode", SqlDbType.VarChar, 50), new SqlParameter("@PrjGuid", SqlDbType.UniqueIdentifier, 0x10), new SqlParameter("@RPayUserCode", SqlDbType.VarChar, 8), new SqlParameter("@RPayDate", SqlDbType.DateTime), new SqlParameter("@ReMark", SqlDbType.VarChar, 100) }; commandParameters[0].Value = model.RPayMainID; commandParameters[1].Value = model.RPayCode; commandParameters[2].Value = model.PrjGuid; commandParameters[3].Value = model.RPayUserCode; commandParameters[4].Value = model.RPayDate; commandParameters[5].Value = model.ReMark; return(SqlHelper.ExecuteNonQuery(CommandType.Text, builder.ToString(), commandParameters) > 0); }
protected void Page_Load(object sender, EventArgs e) { this.hdnPrjguid.Value = base.Request.QueryString["prjId"].ToString(); this.ifSelectFromPlan.Attributes.Add("src ", "SelectPlan.aspx?prjguid=" + this.hdnPrjguid.Value + "&type=payout"); if (!base.IsPostBack) { if (base.Request.QueryString["action"].ToString() == "add") { this.txtRPayCode.Text = DateTime.Now.ToString("yyyyMMddHHmmssfff"); this.hdnCode.Value = Guid.NewGuid().ToString(); this.hdnPerson.Value = base.UserCode; this.txtPerson.Text = com.jwsoft.pm.entpm.PageHelper.QueryUser(this, base.UserCode); this.DateInTime.Text = DateTime.Now.ToString("yyyy-MM-dd"); this.gvwPlan.DataSource = null; this.gvwPlan.DataBind(); } else { this.hdnCode.Value = base.Request.QueryString["ID"].ToString(); this.mainModel = this.mainBll.GetModel(new Guid(this.hdnCode.Value.ToString())); this.txtRPayCode.Text = this.mainModel.RPayCode.ToString(); this.txtPerson.Text = com.jwsoft.pm.entpm.PageHelper.QueryUser(this, this.mainModel.RPayUserCode.ToString()); this.hdnPerson.Value = this.mainModel.RPayUserCode.ToString(); this.DateInTime.Text = this.mainModel.RPayDate.ToString(); this.txtExplain.Text = this.mainModel.ReMark.ToString(); this.txtRPayCode.Enabled = false; DataTable list = this.detailBill.GetList(" RpayMainId='" + this.mainModel.RPayMainID + "'"); list.Columns.Add(new DataColumn("Surplus")); for (int i = 0; i < list.Rows.Count; i++) { list.Rows[i]["Surplus"] = (Convert.ToDecimal(list.Rows[i]["ThisBalance"]) - Convert.ToDecimal(list.Rows[i]["AllowMoney"])).ToString(); } this.ViewState["PlanTable"] = list; this.PlanTableBind(); } this.txtprjName.Text = base.Request.QueryString["prjname"].ToString(); this.flAnnx.MID = 1023; this.flAnnx.FID = this.hdnCode.Value.ToString(); this.flAnnx.Type = 1; } }
public RequestPayMainModel GetModel(Guid RPayMainID) { StringBuilder builder = new StringBuilder(); builder.Append("select top 1 * from Fund_RequestPay_Main "); builder.Append(" where RPayMainID=@RPayMainID "); SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@RPayMainID", SqlDbType.UniqueIdentifier) }; commandParameters[0].Value = RPayMainID; RequestPayMainModel model = new RequestPayMainModel(); DataTable table = SqlHelper.ExecuteQuery(CommandType.Text, builder.ToString(), commandParameters); if (table.Rows.Count <= 0) { return(null); } if (table.Rows[0]["RPayMainID"].ToString() != "") { model.RPayMainID = new Guid(table.Rows[0]["RPayMainID"].ToString()); } model.RPayCode = table.Rows[0]["RPayCode"].ToString(); if (table.Rows[0]["PrjGuid"].ToString() != "") { model.PrjGuid = new Guid(table.Rows[0]["PrjGuid"].ToString()); } if (table.Rows[0]["FlowState"].ToString() != "") { model.FlowState = new int?(int.Parse(table.Rows[0]["FlowState"].ToString())); } model.RPayUserCode = table.Rows[0]["RPayUserCode"].ToString(); if (table.Rows[0]["RPayDate"].ToString() != "") { model.RPayDate = new DateTime?(DateTime.Parse(table.Rows[0]["RPayDate"].ToString())); } model.ReMark = table.Rows[0]["ReMark"].ToString(); return(model); }
public void Update(RequestPayMainModel model) { this.dal.Update(model); }
public void Add(RequestPayMainModel model) { this.dal.Add(model); }