private AccounIncomeModel getModel() { this.accountModel = new AccounIncomeModel(); this.accountModel.ContractID = this.hdnContCode.Value; this.accountModel.GetDate = new DateTime?(Convert.ToDateTime(this.DaGet.Text.ToString())); if (string.IsNullOrEmpty(this.txtGetMoney.Text.ToString())) { this.accountModel.GetMoney = new decimal?(0.00m); } else { this.accountModel.GetMoney = new decimal?(Convert.ToDecimal(this.txtGetMoney.Text.ToString())); } this.accountModel.InCode = this.txtAccCode.Text.ToString(); this.accountModel.InDate = new DateTime?(Convert.ToDateTime(this.txtInDate.Text.ToString())); this.accountModel.InMoney = new decimal?(Convert.ToDecimal(this.txtInMoney.Text.ToString())); this.accountModel.InPeople = this.hdnPeopleCode.Value; this.accountModel.InUid = new Guid(this.hdnAccountID.Value); if (this.hdnPlanUid.Value != "") { this.accountModel.PlanUid = this.hdnPlanUid.Value; } else { this.accountModel.PlanUid = default(Guid).ToString(); } this.accountModel.PrjGuid = this.hdnProjectCode.Value; this.accountModel.Remark = this.txtRemark.Text.ToString(); this.accountModel.Subject = this.ddlType.SelectedValue; return(this.accountModel); }
public bool Update(AccounIncomeModel model) { StringBuilder builder = new StringBuilder(); builder.Append("update Fund_Prj_Accoun_Income set "); builder.Append("PrjGuid=@PrjGuid,"); builder.Append("InCode=@InCode,"); builder.Append("PlanUid=@PlanUid,"); builder.Append("ContractID=@ContractID,"); builder.Append("Subject=@Subject,"); builder.Append("GetDate=@GetDate,"); builder.Append("GetMoney=@GetMoney,"); builder.Append("InMoney=@InMoney,"); builder.Append("InPeople=@InPeople,"); builder.Append("InDate=@InDate,"); builder.Append("Remark=@Remark "); builder.Append(" where InUid=@InUid "); SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@InUid", SqlDbType.UniqueIdentifier, 0x10), new SqlParameter("@PrjGuid", SqlDbType.VarChar, 100), new SqlParameter("@InCode", SqlDbType.VarChar, 100), new SqlParameter("@PlanUid", SqlDbType.VarChar, 100), new SqlParameter("@ContractID", SqlDbType.VarChar, 100), new SqlParameter("@Subject", SqlDbType.VarChar, 100), new SqlParameter("@GetDate", SqlDbType.DateTime), new SqlParameter("@GetMoney", SqlDbType.Decimal, 9), new SqlParameter("@InMoney", SqlDbType.Decimal, 9), new SqlParameter("@InPeople", SqlDbType.VarChar, 100), new SqlParameter("@InDate", SqlDbType.DateTime), new SqlParameter("@Remark", SqlDbType.VarChar) }; commandParameters[0].Value = model.InUid; commandParameters[1].Value = model.PrjGuid; commandParameters[2].Value = model.InCode; commandParameters[3].Value = model.PlanUid; commandParameters[4].Value = model.ContractID; commandParameters[5].Value = model.Subject; commandParameters[6].Value = model.GetDate; commandParameters[7].Value = model.GetMoney; commandParameters[8].Value = model.InMoney; commandParameters[9].Value = model.InPeople; commandParameters[10].Value = model.InDate; commandParameters[11].Value = model.Remark; return(SqlHelper.ExecuteNonQuery(CommandType.Text, builder.ToString(), commandParameters) > 0); }
public AccounIncomeModel GetModel(Guid InUid) { StringBuilder builder = new StringBuilder(); builder.Append("select top 1 InUid,PrjGuid,InCode,PlanUid,Fund_Prj_Accoun_Income.ContractID,Subject,GetDate,GetMoney,InMoney,InPeople,InDate,Fund_Prj_Accoun_Income.Remark,Fund_Prj_Accoun_Income.FlowState,ContractName from Fund_Prj_Accoun_Income "); builder.Append(" left join Con_Incomet_Payment on Fund_Prj_Accoun_Income.ContractID=Con_Incomet_Payment.ID "); builder.Append(" left join Con_Incomet_Contract on Con_Incomet_Payment.ContractID=Con_Incomet_Contract.ContractID "); builder.Append(" where InUid=@InUid "); SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@InUid", SqlDbType.UniqueIdentifier) }; commandParameters[0].Value = InUid; AccounIncomeModel model = new AccounIncomeModel(); DataTable table = SqlHelper.ExecuteQuery(CommandType.Text, builder.ToString(), commandParameters); if (table.Rows.Count <= 0) { return(null); } if (table.Rows[0]["InUid"].ToString() != "") { model.InUid = new Guid(table.Rows[0]["InUid"].ToString()); } model.PrjGuid = table.Rows[0]["PrjGuid"].ToString(); model.InCode = table.Rows[0]["InCode"].ToString(); model.PlanUid = table.Rows[0]["PlanUid"].ToString(); model.ContractID = table.Rows[0]["ContractID"].ToString(); model.Subject = table.Rows[0]["Subject"].ToString(); if (table.Rows[0]["GetDate"].ToString() != "") { model.GetDate = new DateTime?(DateTime.Parse(table.Rows[0]["GetDate"].ToString())); } if (table.Rows[0]["GetMoney"].ToString() != "") { model.GetMoney = new decimal?(decimal.Parse(table.Rows[0]["GetMoney"].ToString())); } if (table.Rows[0]["InMoney"].ToString() != "") { model.InMoney = new decimal?(decimal.Parse(table.Rows[0]["InMoney"].ToString())); } model.InPeople = table.Rows[0]["InPeople"].ToString(); if (table.Rows[0]["InDate"].ToString() != "") { model.InDate = new DateTime?(DateTime.Parse(table.Rows[0]["InDate"].ToString())); } model.Remark = table.Rows[0]["Remark"].ToString(); if (table.Rows[0]["FlowState"].ToString() != "") { model.FlowState = new int?(int.Parse(table.Rows[0]["FlowState"].ToString())); } model.ContractName = table.Rows[0]["ContractName"].ToString(); return(model); }
protected void btnSave_Click(object sender, EventArgs e) { StringBuilder stringBuilder = new StringBuilder(); if (this.ddlType.SelectedValue == "0") { if (string.IsNullOrEmpty(this.hdnContCode.Value)) { stringBuilder.Append("top.ui.alert('合同入账,请选择依据合同');"); base.RegisterScript(stringBuilder.ToString()); return; } if (string.IsNullOrEmpty(this.txtGetMoney.Text) || Convert.ToDecimal(this.txtGetMoney.Text) <= 0m) { base.RegisterScript("top.ui.alert('回款金额不能为空或小于等于零');"); return; } if (Convert.ToDecimal(this.txtInMoney.Text) - Convert.ToDecimal(this.txtGetMoney.Text) > 0m) { base.RegisterScript("top.ui.alert('入账金额不能大于回款金额');"); return; } } this.accountModel = this.getModel(); if (base.Request.QueryString["Action"] == "Add") { this.accountModel.FlowState = new int?(-1); if (!this.AccountBll.Exists(this.accountModel.InCode)) { this.AccountBll.Add(this.accountModel); base.RegisterScript("top.ui.tabSuccess({ parentName: '_accountincome' });"); } else { base.RegisterScript("top.ui.alert('入账单编号重复,请重新输入');"); } } else { if (this.AccountBll.Update(this.accountModel)) { base.RegisterScript("top.ui.tabSuccess({ parentName: '_accountincome' });"); } } base.RegisterScript(stringBuilder.ToString()); }
public List <AccounIncomeModel> DataTableToList(DataTable dt) { List <AccounIncomeModel> list = new List <AccounIncomeModel>(); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { AccounIncomeModel item = new AccounIncomeModel(); if (dt.Rows[i]["InUid"].ToString() != "") { item.InUid = new Guid(dt.Rows[i]["InUid"].ToString()); } item.PrjGuid = dt.Rows[i]["PrjGuid"].ToString(); item.InCode = dt.Rows[i]["InCode"].ToString(); item.PlanUid = dt.Rows[i]["PlanUid"].ToString(); item.ContractID = dt.Rows[i]["ContractID"].ToString(); item.Subject = dt.Rows[i]["Subject"].ToString(); if (dt.Rows[i]["GetDate"].ToString() != "") { item.GetDate = new DateTime?(DateTime.Parse(dt.Rows[i]["GetDate"].ToString())); } if (dt.Rows[i]["GetMoney"].ToString() != "") { item.GetMoney = new decimal?(decimal.Parse(dt.Rows[i]["GetMoney"].ToString())); } if (dt.Rows[i]["InMoney"].ToString() != "") { item.InMoney = new decimal?(decimal.Parse(dt.Rows[i]["InMoney"].ToString())); } item.InPeople = dt.Rows[i]["InPeople"].ToString(); if (dt.Rows[i]["InDate"].ToString() != "") { item.InDate = new DateTime?(DateTime.Parse(dt.Rows[i]["InDate"].ToString())); } item.Remark = dt.Rows[i]["Remark"].ToString(); if (dt.Rows[i]["FlowState"].ToString() != "") { item.FlowState = new int?(int.Parse(dt.Rows[i]["FlowState"].ToString())); } list.Add(item); } } return(list); }
public bool Add(AccounIncomeModel model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into Fund_Prj_Accoun_Income("); builder.Append("InUid,PrjGuid,InCode,PlanUid,ContractID,Subject,GetDate,GetMoney,InMoney,InPeople,InDate,Remark,FlowState)"); builder.Append(" values ("); builder.Append("@InUid,@PrjGuid,@InCode,@PlanUid,@ContractID,@Subject,@GetDate,@GetMoney,@InMoney,@InPeople,@InDate,@Remark,@FlowState)"); SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@InUid", SqlDbType.UniqueIdentifier, 0x10), new SqlParameter("@PrjGuid", SqlDbType.VarChar, 100), new SqlParameter("@InCode", SqlDbType.VarChar, 100), new SqlParameter("@PlanUid", SqlDbType.VarChar, 100), new SqlParameter("@ContractID", SqlDbType.VarChar, 100), new SqlParameter("@Subject", SqlDbType.VarChar, 100), new SqlParameter("@GetDate", SqlDbType.DateTime), new SqlParameter("@GetMoney", SqlDbType.Decimal, 9), new SqlParameter("@InMoney", SqlDbType.Decimal, 9), new SqlParameter("@InPeople", SqlDbType.VarChar, 100), new SqlParameter("@InDate", SqlDbType.DateTime), new SqlParameter("@Remark", SqlDbType.VarChar), new SqlParameter("@FlowState", SqlDbType.Int, 4) }; commandParameters[0].Value = model.InUid; commandParameters[1].Value = model.PrjGuid; commandParameters[2].Value = model.InCode; commandParameters[3].Value = model.PlanUid; commandParameters[4].Value = model.ContractID; commandParameters[5].Value = model.Subject; commandParameters[6].Value = model.GetDate; commandParameters[7].Value = model.GetMoney; commandParameters[8].Value = model.InMoney; commandParameters[9].Value = model.InPeople; commandParameters[10].Value = model.InDate; commandParameters[11].Value = model.Remark; commandParameters[12].Value = model.FlowState; return(SqlHelper.ExecuteNonQuery(CommandType.Text, builder.ToString(), commandParameters) > 0); }
protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { this.ddlType.Attributes.Add("onchange", "TypeChange()"); this.hdnZHID.Value = base.Request.QueryString["ZHID"].ToString(); if (base.Request.QueryString["Action"] == "Add") { this.txtAccCode.Text = DateTime.Now.ToString("yyyyMMddHHmmssfff"); this.hdnAccountID.Value = Guid.NewGuid().ToString(); this.txtInDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); this.txtInPeople.Text = com.jwsoft.pm.entpm.PageHelper.QueryUser(this, base.UserCode); this.hdnPeopleCode.Value = base.UserCode; this.DaGet.Text = DateTime.Now.ToString("yyyy-MM-dd"); this.aM = this.al.GetModel(this.hdnZHID.Value); if (!this.aM.PrjGuid.StartsWith("'")) { PrjInfoModel modelByPrjGuid = this.ptPrjInfo.GetModelByPrjGuid(this.aM.PrjGuid); if (modelByPrjGuid != null) { this.txtPrjName.Text = modelByPrjGuid.PrjName; this.hdnProjectCode.Value = this.aM.PrjGuid; } } } else { this.hdnAccountID.Value = base.Request.QueryString["AccountID"].ToString(); this.accountModel = this.AccountBll.GetModel(new Guid(this.hdnAccountID.Value)); this.txtAccCode.Text = this.accountModel.InCode.ToString(); this.hdnAccountID.Value = this.accountModel.InUid.ToString(); this.txtInDate.Text = Convert.ToDateTime(this.accountModel.InDate).ToString("yyyy-MM-dd"); this.txtInPeople.Text = com.jwsoft.pm.entpm.PageHelper.QueryUser(this, this.accountModel.InPeople); this.hdnPeopleCode.Value = this.accountModel.InPeople; this.DaGet.Text = Convert.ToDateTime(this.accountModel.GetDate).ToString("yyyy-MM-dd"); this.hdnProjectCode.Value = this.accountModel.PrjGuid.ToString(); PrjInfoModel modelByPrjGuid2 = this.ptPrjInfo.GetModelByPrjGuid(this.accountModel.PrjGuid); if (modelByPrjGuid2 != null) { this.txtPrjName.Text = modelByPrjGuid2.PrjName; } this.hdnContCode.Value = this.accountModel.ContractID.ToString(); this.hdnPlanUid.Value = this.accountModel.PlanUid.ToString(); this.ddlType.SelectedValue = this.accountModel.Subject.ToString(); this.txtRemark.Text = this.accountModel.Remark.ToString(); DataTable allNews = this.AccountBll.GetAllNews(this.accountModel.ContractID); if (allNews.Rows.Count > 0) { this.hdnPlanUid.Value = allNews.Rows[0]["UID"].ToString(); if (!string.IsNullOrEmpty(allNews.Rows[0]["PlanDate"].ToString())) { this.txtPlan.Text = Convert.ToDateTime(allNews.Rows[0]["PlanDate"].ToString()).ToString("yyyy年MM月"); this.txtPlanMoney.Text = allNews.Rows[0]["ThisBalance"].ToString(); } else { this.txtPlan.Text = ""; this.txtPlanMoney.Text = "0.00"; } this.txtContName.Text = allNews.Rows[0]["cllectionCode"].ToString(); } this.txtInMoney.Text = this.accountModel.InMoney.ToString(); this.txtGetMoney.Text = this.accountModel.GetMoney.ToString(); } this.FileUpload1.Class = "AccounIncome"; this.FileUpload1.RecordCode = this.hdnAccountID.Value; } }
protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { this.hdnAccountID.Value = base.Request.QueryString["ic"].ToString(); this.accountModel = this.AccountBll.GetModel(new Guid(this.hdnAccountID.Value)); this.lblcode.Text = this.accountModel.InCode.ToString(); this.lblInDate.Text = Convert.ToDateTime(this.accountModel.InDate).ToString("yyyy-MM-dd"); this.lblContractName.Text = this.accountModel.ContractName.ToString(); this.lblInPeople.Text = com.jwsoft.pm.entpm.PageHelper.QueryUser(this, this.accountModel.InPeople); this.DateGetTime.Text = Convert.ToDateTime(this.accountModel.GetDate).ToString("yyyy-MM-dd"); PrjInfoModel modelByPrjGuid = this.ptPrjInfo.GetModelByPrjGuid(this.accountModel.PrjGuid); if (modelByPrjGuid != null) { this.lblProject.Text = modelByPrjGuid.PrjName; } string a; if ((a = this.accountModel.Subject.ToString()) != null) { if (!(a == "0")) { if (!(a == "1")) { if (a == "2") { this.lblsubject.Text = "其他入账"; } } else { this.lblsubject.Text = "启动资金"; } } else { this.lblsubject.Text = "合同入账"; } } this.hdnsubject.Value = this.accountModel.Subject.ToString(); this.lblRemark.Text = this.accountModel.Remark.ToString(); DataTable allNews = this.AccountBll.GetAllNews(this.accountModel.ContractID); if (allNews.Rows.Count > 0) { if (!string.IsNullOrEmpty(allNews.Rows[0]["PlanDate"].ToString())) { this.lblPlan.Text = Convert.ToDateTime(allNews.Rows[0]["PlanDate"].ToString()).ToString("yyyy年MM月"); this.lblPlanMoney.Text = allNews.Rows[0]["ThisBalance"].ToString(); } else { this.lblPlan.Text = ""; this.lblPlanMoney.Text = "0.00"; } this.lblContName.Text = allNews.Rows[0]["cllectionCode"].ToString(); } this.lblInMoney.Text = this.accountModel.InMoney.ToString(); this.lblGetMoney.Text = this.accountModel.GetMoney.ToString(); this.upload.InnerHtml = this.FilesBind(this.hdnAccountID.Value); this.lblPrintDate.Text = DateTime.Now.ToShortDateString(); this.lblPrintPeople.Text = com.jwsoft.pm.entpm.action.PageHelper.QueryUser(this, base.UserCode); } }
public bool Add(AccounIncomeModel model) { return(this.dal.Add(model)); }
public bool Update(AccounIncomeModel model) { return(this.dal.Update(model)); }