private void LockButton() { bool flag = cn.justwin.Domain.BudTaskChange.IsAllowBudget(this.prjId); this.hfldIsLocked.Value = (!flag).ToString(); cn.justwin.Domain.BudTaskChange taskChange = cn.justwin.Domain.BudTaskChange.GetTaskChange(this.prjId); if (taskChange != null) { this.hfldTaskChangeId.Value = taskChange.Id; this.hfldFlowstate.Value = ((!taskChange.Flowstate.HasValue) ? "" : taskChange.Flowstate.ToString()); if (DBHelper.GetInt(taskChange.Version) == 1 && this.hfldFlowstate.Value == "0") { this.hfldIsAllowWithdraw.Value = "True"; } this.lblLockPrjMessage.Text = "(" + Common2.GetStateNoColor(this.hfldFlowstate.Value.ToString()) + ")"; if (DBHelper.GetInt(taskChange.Version) != 1) { this.lblLockPrjMessage.Text = "(已审核)"; return; } } else { this.hfldTaskChangeId.Value = ""; this.hfldFlowstate.Value = "-1"; this.hfldIsLocked.Value = "False"; this.lblLockPrjMessage.Text = "(未提交)"; } }
public static BudTaskChange GetTaskChange(string prjId) { BudTaskChange change = new BudTaskChange(); using (pm2Entities entities = new pm2Entities()) { return((from t in entities.Bud_TaskChange where t.PrjId == prjId select new BudTaskChange { Id = t.TaskChangeId, PrjId = t.PrjId, Version = t.Version, VersionCode = t.VersionCode, Flowstate = t.FlowState, Note = t.Note, InputUser = t.InputUser, InputDate = t.InputDate }).FirstOrDefault <BudTaskChange>()); } }
public static void Update(BudTaskChange budTaskChange) { using (pm2Entities entities = new pm2Entities()) { Bud_TaskChange change = (from t in entities.Bud_TaskChange where t.TaskChangeId == budTaskChange.Id select t).FirstOrDefault <Bud_TaskChange>(); if (change != null) { change.Version = budTaskChange.Version; change.VersionCode = budTaskChange.VersionCode; change.FlowState = budTaskChange.Flowstate; change.InputUser = budTaskChange.InputUser; change.Note = budTaskChange.Note; } entities.SaveChanges(); } }
public static void Add(BudTaskChange budTaskChange) { using (pm2Entities entities = new pm2Entities()) { Bud_TaskChange change = new Bud_TaskChange { TaskChangeId = budTaskChange.Id, PrjId = budTaskChange.PrjId, Version = budTaskChange.Version, VersionCode = budTaskChange.VersionCode, FlowState = budTaskChange.Flowstate, Note = budTaskChange.Note, InputUser = budTaskChange.InputUser, InputDate = new DateTime?(DateTime.Now) }; entities.AddToBud_TaskChange(change); entities.SaveChanges(); } }
public void BindGv() { cn.justwin.Domain.BudTaskChange taskChange = cn.justwin.Domain.BudTaskChange.GetTaskChange(this.prjId); if (taskChange != null) { DataTable taskInfo = cn.justwin.Domain.BudTask.GetTaskInfo(this.prjId, this.hfldIsWBSRelevance.Value, string.Empty, string.Empty, string.Empty); this.gvBudget.DataSource = taskInfo; this.gvBudget.DataBind(); if (!string.IsNullOrEmpty(this.prjId)) { PTPrjInfoService pTPrjInfoService = new PTPrjInfoService(); PTPrjInfo byId = pTPrjInfoService.GetById(this.prjId); if (byId != null) { this.lblPrjName.Text = byId.PrjName; } } int wBSFlowState = Project.GetWBSFlowState(this.prjId); bool flag = cn.justwin.Domain.BudTaskChange.IsAllowBudget(this.prjId); this.hfldIsLocked.Value = (!flag).ToString(); Label expr_BC = this.lblPrjName; expr_BC.Text = expr_BC.Text + "(" + Common2.GetStateNoColor(wBSFlowState.ToString()) + ")"; } }