public PlanSummaryMain GetModel(Guid MID) { StringBuilder builder = new StringBuilder(); builder.Append("select top 1 MID,PlanName,Reporter,ReportTime,FlowState,remark,PlanType from Fund_Plan_Summary_Main "); builder.Append(" where MID=@MID "); SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@MID", SqlDbType.UniqueIdentifier) }; commandParameters[0].Value = MID; PlanSummaryMain main = new PlanSummaryMain(); DataTable table = SqlHelper.ExecuteQuery(CommandType.Text, builder.ToString(), commandParameters); if (table.Rows.Count <= 0) { return(null); } if (table.Rows[0]["MID"].ToString() != "") { main.MID = new Guid(table.Rows[0]["MID"].ToString()); } main.PlanName = table.Rows[0]["PlanName"].ToString(); main.Reporter = table.Rows[0]["Reporter"].ToString(); if (table.Rows[0]["ReportTime"].ToString() != "") { main.ReportTime = new DateTime?(DateTime.Parse(table.Rows[0]["ReportTime"].ToString())); } if (table.Rows[0]["FlowState"].ToString() != "") { main.FlowState = new int?(int.Parse(table.Rows[0]["FlowState"].ToString())); } main.remark = table.Rows[0]["remark"].ToString(); main.PlanType = table.Rows[0]["PlanType"].ToString(); return(main); }
public List <PlanSummaryMain> DataTableToList(DataTable dt) { List <PlanSummaryMain> list = new List <PlanSummaryMain>(); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { PlanSummaryMain item = new PlanSummaryMain(); if (dt.Rows[i]["MID"].ToString() != "") { item.MID = new Guid(dt.Rows[i]["MID"].ToString()); } item.PlanName = dt.Rows[i]["PlanName"].ToString(); item.Reporter = dt.Rows[i]["Reporter"].ToString(); if (dt.Rows[i]["ReportTime"].ToString() != "") { item.ReportTime = new DateTime?(DateTime.Parse(dt.Rows[i]["ReportTime"].ToString())); } if (dt.Rows[i]["FlowState"].ToString() != "") { item.FlowState = new int?(int.Parse(dt.Rows[i]["FlowState"].ToString())); } item.remark = dt.Rows[i]["remark"].ToString(); item.PlanType = dt.Rows[i]["PlanType"].ToString(); list.Add(item); } } return(list); }
protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { this.hdnAccountID.Value = base.Request.QueryString["ic"].ToString(); this.MainModel = this.MainBLL.GetModel(new Guid(this.hdnAccountID.Value)); if (this.MainModel.PlanType == "payout") { this.lblTitle.Text = "月支计划上报查看"; } else { this.lblTitle.Text = "月收计划上报查看"; } this.lblPlanName.Text = this.MainModel.PlanName.ToString(); this.lblRemark.Text = this.MainModel.remark.ToString(); this.lblInDate.Text = Convert.ToDateTime(this.MainModel.ReportTime).ToString("yyyy-MM-dd"); this.lblInPeople.Text = PageHelper.QueryUser(this, this.MainModel.Reporter); DataTable list = this.DetailBLL.GetList(" MID ='" + this.hdnAccountID.Value + "' "); for (int i = 0; i < list.Rows.Count; i++) { this.LastPlanMoney += Convert.ToDecimal(list.Rows[i]["LastPlanMoney"].ToString()); this.LastActualMoney += Convert.ToDecimal(list.Rows[i]["LastActualMoney"].ToString()); this.CurrPlanMoney += Convert.ToDecimal(list.Rows[i]["CurrPlanMoney"].ToString()); } this.gvwDetail.DataSource = list; this.gvwDetail.DataBind(); this.upload.InnerHtml = this.FilesBind(this.hdnAccountID.Value); this.lblPrintDate.Text = DateTime.Now.ToShortDateString(); this.lblPrintPeople.Text = PageHelper.QueryUser(this, base.UserCode); } }
protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { this.HdnPlanType.Value = base.Request["PlanType"].ToString(); if (base.Request.QueryString["Action"] == "Add") { this.txtInPeople.Text = PageHelper.QueryUser(this, base.UserCode); this.hdnPeopleCode.Value = base.UserCode; this.txtInDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); this.hdnAccountID.Value = Guid.NewGuid().ToString(); } else { this.txtDate.ReadOnly = true; this.hdnAccountID.Value = base.Request.QueryString["AccountID"].ToString(); this.MainModel = this.MainBLL.GetModel(new Guid(this.hdnAccountID.Value)); this.txtDate.Text = this.MainModel.PlanName.ToString(); this.txtre.Text = this.MainModel.remark; this.hdnPeopleCode.Value = this.MainModel.Reporter.ToString(); this.txtInPeople.Text = PageHelper.QueryUser(this, this.MainModel.Reporter.ToString()); this.txtInDate.Text = Convert.ToDateTime(this.MainModel.ReportTime).ToString("yyyy-MM-dd"); this.BtnPlanSummary.Text = "按提交的计划重新生成"; this.BindDetail(); } this.FileUpload1.Class = "PlanSummary"; this.FileUpload1.RecordCode = this.hdnAccountID.Value; } }
protected void btnSave_Click(object sender, EventArgs e) { StringBuilder stringBuilder = new StringBuilder(); this.MainModel = this.getModel(); if (base.Request.QueryString["Action"] == "Add") { this.MainModel.FlowState = new int?(-1); if (!this.MainBLL.Exists(this.MainModel.PlanName, base.Request["PlanType"].ToString())) { this.SaveDetail(this.MainModel.MID.ToString()); this.MainBLL.Add(this.MainModel); stringBuilder.Append("winclose('ModifyEdit', 'PlanSummary.aspx?PlanType=" + base.Request["PlanType"].ToString() + "&State=Manage', true)"); } else { this.SetSource(new DataTable()); stringBuilder.Append("alert('系统提示:\\n\\n该月份的计划汇总已存在!');"); } } else { this.SaveDetail(this.MainModel.MID.ToString()); if (this.MainBLL.Update(this.MainModel)) { stringBuilder.Append("winclose('ModifyEdit', 'PlanSummary.aspx?PlanType=" + base.Request["PlanType"].ToString() + "&State=Manage', true)"); } } base.RegisterScript(stringBuilder.ToString()); }
private PlanSummaryMain getModel() { this.MainModel = new PlanSummaryMain(); this.MainModel.PlanName = this.txtDate.Text; this.MainModel.PlanType = base.Request["PlanType"].ToString(); this.MainModel.remark = this.txtre.Text; this.MainModel.Reporter = this.hdnPeopleCode.Value; this.MainModel.ReportTime = new DateTime?(Convert.ToDateTime(this.txtInDate.Text)); this.MainModel.MID = new Guid(this.hdnAccountID.Value); return(this.MainModel); }
public bool Update(PlanSummaryMain model) { StringBuilder builder = new StringBuilder(); builder.Append("update Fund_Plan_Summary_Main set "); builder.Append("Reporter=@Reporter,"); builder.Append("ReportTime=@ReportTime,"); builder.Append("remark=@remark "); builder.Append(" where MID=@MID "); SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@MID", SqlDbType.UniqueIdentifier, 0x10), new SqlParameter("@Reporter", SqlDbType.VarChar, 50), new SqlParameter("@ReportTime", SqlDbType.DateTime), new SqlParameter("@remark", SqlDbType.VarChar) }; commandParameters[0].Value = model.MID; commandParameters[1].Value = model.Reporter; commandParameters[2].Value = model.ReportTime; commandParameters[3].Value = model.remark; return(SqlHelper.ExecuteNonQuery(CommandType.Text, builder.ToString(), commandParameters) > 0); }
public bool Add(PlanSummaryMain model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into Fund_Plan_Summary_Main("); builder.Append("MID,PlanName,Reporter,ReportTime,FlowState,remark,PlanType)"); builder.Append(" values ("); builder.Append("@MID,@PlanName,@Reporter,@ReportTime,@FlowState,@remark,@PlanType)"); SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@MID", SqlDbType.UniqueIdentifier, 0x10), new SqlParameter("@PlanName", SqlDbType.VarChar, 50), new SqlParameter("@Reporter", SqlDbType.VarChar, 50), new SqlParameter("@ReportTime", SqlDbType.DateTime), new SqlParameter("@FlowState", SqlDbType.Int, 4), new SqlParameter("@remark", SqlDbType.VarChar), new SqlParameter("@PlanType", SqlDbType.VarChar, 50) }; commandParameters[0].Value = model.MID; commandParameters[1].Value = model.PlanName; commandParameters[2].Value = model.Reporter; commandParameters[3].Value = model.ReportTime; commandParameters[4].Value = model.FlowState; commandParameters[5].Value = model.remark; commandParameters[6].Value = model.PlanType; return(SqlHelper.ExecuteNonQuery(CommandType.Text, builder.ToString(), commandParameters) > 0); }
public bool Update(PlanSummaryMain model) { return(this.dal.Update(model)); }
public void Add(PlanSummaryMain model) { this.dal.Add(model); }