Пример #1
0
        public void SaveProjectBasedata(ProjectBasedata project)
        {
            using (var dbContext = new ProjectDbContext())
            {

                if (project.ID>0)
                {
                    dbContext.Update<ProjectBasedata>(project);
                }
                else
                {
                    dbContext.Insert<ProjectBasedata>(project);
                }
            }
        }
Пример #2
0
        public void SaveBudget(BudgetInfo budget)
        {
            using (var dbContext = new ProjectDbContext())
            {

                if (budget.ID >0)
                {
                    dbContext.Update<BudgetInfo>(budget);
                }
                else
                {
                    dbContext.Insert<BudgetInfo>(budget);
                }
            }
        }
Пример #3
0
        public void SaveInsOverhead(InsOverhead insoverhead)
        {
            using (var dbContext = new ProjectDbContext())
            {
                //var budgets = dbContext.Budgets.ToList();

                if (insoverhead.ID > 0)
                {
                //    if (overhead.OverheadTotal > 0)
                //    {
                //        foreach (var budget in budgets)
                //        {
                //            if (budget.ProjectID == overhead.ProjectID)
                //            {
                //                budget.OverheadID = overhead.ID;
                //                dbContext.Update<BudgetInfo>(budget);
                //            }
                //        }
                //    }
                    dbContext.Update<InsOverhead>(insoverhead);
                }
                else
                {
                    dbContext.Insert<InsOverhead>(insoverhead);
                }
            }
        }
Пример #4
0
        public void SaveInsMeasure(InsMeasure insmeasure)
        {
            using (var dbContext = new ProjectDbContext())
            {

                if (insmeasure.ID > 0)
                {
                    //var budgets = dbContext.Budgets.ToList();
                    //if (measure.MeasureTotal > 0)
                    //{
                    //    foreach (var budget in budgets)
                    //    {
                    //        if (budget.ProjectID == measure.ProjectID)
                    //        {
                    //            budget.MeasureID = measure.ID;
                    //            dbContext.Update<BudgetInfo>(budget);
                    //        }
                    //    }
                    //}
                    dbContext.Update<InsMeasure>(insmeasure);
                }
                else
                {
                    dbContext.Insert<InsMeasure>(insmeasure);
                }
            }
        }
Пример #5
0
        public void SaveInsMachineryCost(InsMachineryCost insmachinerycost)
        {
            using (var dbContext = new ProjectDbContext())
            {

                if (insmachinerycost.ID > 0)
                {
                    //var budgets = dbContext.Budgets.ToList();
                    //if (machinerycost.MachineryTotal > 0)
                    //{
                    //    foreach (var budget in budgets)
                    //    {
                    //        if (budget.ProjectID == machinerycost.ProjectID)
                    //        {
                    //            budget.MachineryCostID = machinerycost.ID;
                    //            dbContext.Update<BudgetInfo>(budget);
                    //        }
                    //    }
                    //}
                    dbContext.Update<InsMachineryCost>(insmachinerycost);
                }
                else
                {
                    dbContext.Insert<InsMachineryCost>(insmachinerycost);
                }
            }
        }
Пример #6
0
        public void SaveInsBudget(InsBudgetInfo insbudget)
        {
            using (var dbContext = new ProjectDbContext())
            {

                if (insbudget.ID > 0)
                {
                    dbContext.Update<InsBudgetInfo>(insbudget);
                }
                else
                {
                    dbContext.Insert<InsBudgetInfo>(insbudget);
                }
            }
        }
Пример #7
0
        public void SaveAccounting(Accounting accounting)
        {
            using (var dbContext = new ProjectDbContext())
            {

                if (accounting.ID > 0)
                {

                    dbContext.Update<Accounting>(accounting);
                }
                else
                {
                    dbContext.Insert<Accounting>(accounting);
                }
            }
        }
Пример #8
0
        public void SaveIncome(Income income)
        {
            using (var dbContext = new ProjectDbContext())
            {

                if (income.ID > 0)
                {

                    dbContext.Update<Income>(income);
                }
                else
                {
                    dbContext.Insert<Income>(income);
                }
            }
        }
Пример #9
0
        public void SaveOverhead(Overhead overhead)
        {
            using (var dbContext = new ProjectDbContext())
            {
                var budgets = dbContext.Budgets.ToList();

                if (overhead.ID>0)
                {
                    if (overhead.OverheadTotal > 0)
                    {
                        foreach (var budget in budgets)
                        {
                            if (budget.ProjectID == overhead.ProjectID)
                            {
                                budget.OverheadID = overhead.ID;
                                dbContext.Update<BudgetInfo>(budget);
                            }
                        }
                    }
                    dbContext.Update<Overhead>(overhead);
                }
                else
                {
                    dbContext.Insert<Overhead>(overhead);
                }
            }
        }
Пример #10
0
        public void SaveMeasure(Measure measure)
        {
            using (var dbContext = new ProjectDbContext())
            {

                if (measure.ID >0)
                {
                    var budgets = dbContext.Budgets.ToList();
                    if (measure.MeasureTotal > 0)
                    {
                        foreach (var budget in budgets)
                        {
                            if (budget.ProjectID == measure.ProjectID)
                            {
                                budget.MeasureID = measure.ID;
                                dbContext.Update<BudgetInfo>(budget);
                            }
                        }
                    }
                    dbContext.Update<Measure>(measure);
                }
                else
                {
                    dbContext.Insert<Measure>(measure);
                }
            }
        }
Пример #11
0
        public void SaveMachineryCost(MachineryCost machinerycost)
        {
            using (var dbContext = new ProjectDbContext())
            {

                if (machinerycost.ID >0)
                {
                    var budgets = dbContext.Budgets.ToList();
                    if (machinerycost.MachineryTotal > 0)
                    {
                        foreach (var budget in budgets)
                        {
                            if (budget.ProjectID == machinerycost.ProjectID)
                            {
                                budget.MachineryCostID = machinerycost.ID;
                                dbContext.Update<BudgetInfo>(budget);
                            }
                        }
                    }
                    dbContext.Update<MachineryCost>(machinerycost);
                }
                else
                {
                    dbContext.Insert<MachineryCost>(machinerycost);
                }
            }
        }
Пример #12
0
        public void SaveLaborCost(LaborCost laborcost)
        {
            using (var dbContext = new ProjectDbContext())
            {
               
            

                if (laborcost.ID >0)
                {
                    var budgets = dbContext.Budgets.ToList();
                    if (laborcost.LaborTotal > 0)
                    {
                        foreach (var budget in budgets)
                        {
                            if (budget.ProjectID == laborcost.ProjectID)
                            {
                                budget.LaborCostID = laborcost.ID;
                                dbContext.Update<BudgetInfo>(budget);
                            }
                        }
                    }
                    dbContext.Update<LaborCost>(laborcost);
                }
                else
                {
                    dbContext.Insert<LaborCost>(laborcost);
                }
            }
        }
Пример #13
0
 public void SaveOfficeCtrl(OfficeCtrl offices)
 {
     using (var dbContext = new ProjectDbContext())
     {
         if (offices.ID > 0)
         {
             dbContext.Update<OfficeCtrl>(offices);
         }
         else
         {
             dbContext.Insert<OfficeCtrl>(offices);
         }
     }
 }
Пример #14
0
        public void SavePayables(Payables pay)
        {
            using (var dbContext = new ProjectDbContext())
            {

                if (pay.ID > 0)
                {

                    dbContext.Update<Payables>(pay);
                }
                else
                {
                    dbContext.Insert<Payables>(pay);
                }
            }
        }
Пример #15
0
 public void SaveFile(Files file)
 {
     using (var dbContext = new ProjectDbContext())
     {
         if (file.ID > 0)
         {
             dbContext.Update<Files>(file);
         }
         else
         {
             dbContext.Insert<Files>(file);
         }
     }
 }
Пример #16
0
 public void SaveOddments(Oddments oddments)
 {
     using (var dbContext = new ProjectDbContext())
     {
         if (oddments.ID > 0)
         {
             dbContext.Update<Oddments>(oddments);
         }
         else
         {
             dbContext.Insert<Oddments>(oddments);
         }
     }
 }
Пример #17
0
 public void SaveOdder(Odder project)
 {
     using (var dbContext = new ProjectDbContext())
     {
         if (project.ID > 0)
         {
             dbContext.Update<Odder>(project);
         }
         else
         {
             dbContext.Insert<Odder>(project);
         }
     }
 }