protected PrjMilestone GetModel() { PrjMilestone prjMilestone = new PrjMilestone(); prjMilestone.Id = (string.IsNullOrEmpty(this.Id) ? System.Guid.NewGuid().ToString() : this.Id); prjMilestone.RptDate = System.Convert.ToDateTime(this.hlfRptDate.Value.Trim()); prjMilestone.UserCode = this.hlfUserCode.Value.Trim(); decimal num = string.IsNullOrEmpty(this.txtStoreAmont.Text.Trim()) ? 0m : System.Convert.ToDecimal(this.txtStoreAmont.Text.Trim()); prjMilestone.StoreAmount = num; decimal num2 = string.IsNullOrEmpty(this.txtForeCast.Text.Trim()) ? 0m : System.Convert.ToDecimal(this.txtForeCast.Text.Trim()); prjMilestone.ForeCast = num2; prjMilestone.StoreSwitchRate = decimal.Divide(num2, num); decimal nextForeCast = string.IsNullOrEmpty(this.txtNextForeCast.Text.Trim()) ? (num - num2) : System.Convert.ToDecimal(this.txtNextForeCast.Text.Trim()); prjMilestone.NextForeCast = nextForeCast; prjMilestone.Stone1 = (string.IsNullOrEmpty(this.txtSton1.Text.Trim()) ? 0 : System.Convert.ToInt32(this.txtSton1.Text.Trim())); prjMilestone.Stone2 = (string.IsNullOrEmpty(this.txtSton2.Text.Trim()) ? 0 : System.Convert.ToInt32(this.txtSton2.Text.Trim())); prjMilestone.Stone3 = (string.IsNullOrEmpty(this.txtSton3.Text.Trim()) ? 0 : System.Convert.ToInt32(this.txtSton3.Text.Trim())); prjMilestone.Stone4 = (string.IsNullOrEmpty(this.txtSton4.Text.Trim()) ? 0 : System.Convert.ToInt32(this.txtSton4.Text.Trim())); prjMilestone.Stone5 = (string.IsNullOrEmpty(this.txtSton5.Text.Trim()) ? 0 : System.Convert.ToInt32(this.txtSton5.Text.Trim())); prjMilestone.Stone6 = (string.IsNullOrEmpty(this.txtSton6.Text.Trim()) ? 0 : System.Convert.ToInt32(this.txtSton6.Text.Trim())); prjMilestone.Stone7 = (string.IsNullOrEmpty(this.txtSton7.Text.Trim()) ? 0 : System.Convert.ToInt32(this.txtSton7.Text.Trim())); prjMilestone.Stone8 = (string.IsNullOrEmpty(this.txtSton8.Text.Trim()) ? 0 : System.Convert.ToInt32(this.txtSton8.Text.Trim())); prjMilestone.Stone9 = (string.IsNullOrEmpty(this.txtSton9.Text.Trim()) ? 0 : System.Convert.ToInt32(this.txtSton9.Text.Trim())); return(prjMilestone); }
protected void btnSave_Click(object sender, System.EventArgs e) { PrjMilestone model = this.GetModel(); if (this.IsExists(model)) { string str = string.Empty; if (model.RptDate <= System.DateTime.Today.AddDays((double)(1 - System.DateTime.Today.Day + 13))) { str = "上半月数据已存在,请在下半月填写相关数据!"; } else { str = "下半月数据已存在,请再下个月的上半月填写相关数据!"; } base.RegisterScript("top.ui.alert('" + str + "');"); return; } if (this.type == "Add") { this.PrjMileSer.Add(model); } else { if (this.type == "Edit") { this.PrjMileSer.Update(model); } } base.RegisterScript("top.ui.tabSuccess({parentName:'_PrjMilestoneList'});"); }
protected int GetPrjCount(string Id) { int result = 0; if (!string.IsNullOrEmpty(Id)) { PrjMilestone byId = this.prjMileSer.GetById(Id); result = byId.Stone1 + byId.Stone2 + byId.Stone3 + byId.Stone4 + byId.Stone5 + byId.Stone6 + byId.Stone7 + byId.Stone8 + byId.Stone9; } return(result); }
protected void Bindpage() { if (!string.IsNullOrEmpty(this.Id)) { PrjMilestone byId = this.PrjMileSer.GetById(this.Id); if (byId != null) { this.hlfUserCode.Value = byId.UserCode; this.txtUserName.Text = this.ptyhSer.GetName(byId.UserCode); this.txtStoreAmont.Text = byId.StoreAmount.ToString(); this.txtForeCast.Text = byId.ForeCast.ToString(); this.txtNextForeCast.Text = byId.NextForeCast.ToString(); System.DateTime rptDate = byId.RptDate; this.hlfRptDate.Value = Common2.GetTime(rptDate); if (rptDate.Day > System.DateTime.Today.AddDays((double)(1 - System.DateTime.Today.Day + 13)).Day) { this.txtRptDate.Text = string.Concat(new object[] { rptDate.Year, "年-", rptDate.Month, "月-下半月" }); } else { this.txtRptDate.Text = string.Concat(new object[] { rptDate.Year, "年-", rptDate.Month, "月-上半月" }); } this.txtSton1.Text = byId.Stone1.ToString(); this.txtSton2.Text = byId.Stone2.ToString(); this.txtSton3.Text = byId.Stone3.ToString(); this.txtSton4.Text = byId.Stone4.ToString(); this.txtSton5.Text = byId.Stone5.ToString(); this.txtSton6.Text = byId.Stone6.ToString(); this.txtSton7.Text = byId.Stone7.ToString(); this.txtSton8.Text = byId.Stone8.ToString(); this.txtSton9.Text = byId.Stone9.ToString(); } } }
protected bool IsExists(PrjMilestone model) { bool result; if (this.type == "Add") { result = (( from p in this.PrjMileSer where p.UserCode == model.UserCode && p.RptDate == model.RptDate select p).Count <PrjMilestone>() > 0); } else { result = (( from p in this.PrjMileSer where p.UserCode == model.UserCode && p.RptDate == model.RptDate && p.Id != model.Id select p).Count <PrjMilestone>() > 0); } return(result); }