Beispiel #1
0
 public static void UpdateState(string CBSCode, string prjId, string state)
 {
     using (pm2Entities entities = new pm2Entities())
     {
         Bud_IndirectBudget budget = (from m in entities.Bud_IndirectBudget
                                      where (m.CBSCode == CBSCode) && (m.ProjectId == prjId)
                                      select m).FirstOrDefault <Bud_IndirectBudget>();
         if (budget != null)
         {
             budget.State = state;
             entities.SaveChanges();
         }
     }
 }
Beispiel #2
0
 public void Update(IndirectBudget indirectBudget)
 {
     using (pm2Entities entities = new pm2Entities())
     {
         Bud_IndirectBudget budget = (from m in entities.Bud_IndirectBudget
                                      where (m.ProjectId == indirectBudget.ProjectId) && (m.CBSCode == indirectBudget.CBSCode)
                                      select m).FirstOrDefault <Bud_IndirectBudget>();
         if (budget == null)
         {
             throw new Exception("此项目的间接成本预算不存在!");
         }
         budget.BudgetAmount  = indirectBudget.BudgetAmount;
         budget.AccountAmount = indirectBudget.AccountAmount;
         budget.State         = indirectBudget.State;
         entities.SaveChanges();
     }
 }
Beispiel #3
0
 public void Add(IndirectMonthBudget indirMonthBudget)
 {
     using (pm2Entities entities = new pm2Entities())
     {
         Bud_IndirectBudget budget = (from m in entities.Bud_IndirectBudget
                                      where m.Id == indirMonthBudget.IndirectBudgetId
                                      select m).FirstOrDefault <Bud_IndirectBudget>();
         Bud_IndirectMonthBudget budget2 = new Bud_IndirectMonthBudget {
             Id                 = indirMonthBudget.Id,
             Amount             = new decimal?(indirMonthBudget.Amount),
             Month              = indirMonthBudget.Month,
             Year               = indirMonthBudget.Year,
             Bud_IndirectBudget = budget
         };
         entities.AddToBud_IndirectMonthBudget(budget2);
         entities.SaveChanges();
     }
 }
Beispiel #4
0
 public void Add(IndirectBudget indirectBudget)
 {
     using (pm2Entities entities = new pm2Entities())
     {
         Bud_IndirectBudget budget = new Bud_IndirectBudget {
             Id            = indirectBudget.Id,
             BudgetAmount  = indirectBudget.BudgetAmount,
             AccountAmount = indirectBudget.AccountAmount,
             CBSCode       = indirectBudget.CBSCode,
             ProjectId     = indirectBudget.ProjectId,
             State         = indirectBudget.State,
             Note          = indirectBudget.Note,
             InputUser     = indirectBudget.InputUser,
             InputDate     = this.InputDate
         };
         entities.AddToBud_IndirectBudget(budget);
         entities.SaveChanges();
     }
 }