public static int?GetFlowState(string prjId) { using (pm2Entities entities = new pm2Entities()) { Bud_TaskChange change = (from t in entities.Bud_TaskChange where t.PrjId == prjId orderby t.Version descending select t).FirstOrDefault <Bud_TaskChange>(); if (change != null) { return(change.FlowState); } return(null); } }
public static int GetWBSFlowState(string prjId) { int num = -1; using (pm2Entities entities = new pm2Entities()) { Bud_TaskChange change = (from c in entities.Bud_TaskChange where (c.PrjId == prjId) && (c.Version == 1) select c).FirstOrDefault <Bud_TaskChange>(); if (change != null) { num = change.FlowState.Value; } } return(num); }
public static bool IsAllowBudgetChange(string prjId) { bool flag = false; using (pm2Entities entities = new pm2Entities()) { Bud_TaskChange change = (from t in entities.Bud_TaskChange where (t.PrjId == prjId) && (t.Version == 1) select t).FirstOrDefault <Bud_TaskChange>(); if ((change != null) && (change.FlowState == 1)) { flag = true; } } return(flag); }
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(); } }