Exemple #1
0
 public void DeleteProjectBasedata(List<int> ids)
 {
     using (var dbContext = new ProjectDbContext())
     {
         dbContext.ProjectBasedatas.Where(u => ids.Contains(u.ID)).Delete();
     }
 }
Exemple #2
0
 public BudgetInfo GetBudget(int id)
 {
     using (var dbContext = new ProjectDbContext())
     {
         return dbContext.Find<BudgetInfo>(id);
     }
 }
Exemple #3
0
 public ProjectBasedata GetProjectBasedata(int id)
 {
     using (var dbContext = new ProjectDbContext())
     {
         return dbContext.Find<ProjectBasedata>(id);
     }
 }
Exemple #4
0
 public IEnumerable<BudgetInfo> GetBudgetList(BudgetRequest request = null)
 {
     request = request ?? new BudgetRequest();
     using (var dbContext = new ProjectDbContext())
     {
         IQueryable<BudgetInfo> Budgets = dbContext.Budgets.Include("LaborCost").Include("Overhead").Include("MachineryCost").Include("MaterialCost").Include("Measure");              
         if (!string.IsNullOrEmpty(request.ProjectName))
             Budgets = Budgets.Where(u => u.ProjectName.Contains(request.ProjectName));                  
         return Budgets.OrderByDescending(u => u.ID).ToPagedList(request.PageIndex, request.PageSize);
     }
 }
Exemple #5
0
        public void SaveProjectBasedata(ProjectBasedata project)
        {
            using (var dbContext = new ProjectDbContext())
            {

                if (project.ID>0)
                {
                    dbContext.Update<ProjectBasedata>(project);
                }
                else
                {
                    dbContext.Insert<ProjectBasedata>(project);
                }
            }
        }
Exemple #6
0
        public IEnumerable<ProjectBasedata> GetProjectBasedataList(ProjectRequest request = null)
        {
            request = request ?? new ProjectRequest();
            using (var dbContext = new ProjectDbContext())
            {
                IQueryable<ProjectBasedata> ProjectBasedatas = dbContext.ProjectBasedatas;

                if (!string.IsNullOrEmpty(request.PName))
                    ProjectBasedatas = ProjectBasedatas.Where(u => u.PName.Contains(request.PName));
                if (!string.IsNullOrEmpty(request.Status))
                    ProjectBasedatas = ProjectBasedatas.Where(u => u.Status.Contains(request.Status));
                if (!string.IsNullOrEmpty(request.Fund))
                    ProjectBasedatas = ProjectBasedatas.Where(u => u.Fund.Contains(request.Fund));
                return ProjectBasedatas.OrderByDescending(u => u.ID).ToPagedList(request.PageIndex, request.PageSize);


            }
        }
Exemple #7
0
        public IEnumerable<InsOverhead> GetInsOverheadList(InsOverheadRequest request = null)
        {
            request = request ?? new InsOverheadRequest();
            using (var dbContext = new ProjectDbContext())
            {
                IQueryable<InsOverhead> InsOverhead = dbContext.InsOverheads.Include("ProjectBasedata");

                if (request.ProjectBasedataID > 0)
                    InsOverhead = InsOverhead.Where(d => d.ProjectBasedataID == request.ProjectBasedataID);

                return InsOverhead.OrderByDescending(u => u.ID).ToPagedList(request.PageIndex, request.PageSize);
            }
        }
Exemple #8
0
 public InsOverhead GetInsOverhead(int id)
 {
     using (var dbContext = new ProjectDbContext())
     {
         var model = dbContext.Find<InsOverhead>(id);
         model.ProjectBasedata = GetProjectBasedata(model.ProjectBasedataID);
         return model;
         //return dbContext.Find<InsOverhead>(id);
     }
 }
Exemple #9
0
 public Accounting GetAccounting(int id)
 {
     using (var dbContext = new ProjectDbContext())
     {
         return dbContext.Find<Accounting>(id);
     }
 }
Exemple #10
0
        public IEnumerable<Oddments> GetOddmentsList(OddmentsRequest request = null)
        {
            request = request ?? new OddmentsRequest();
            using (var dbContext = new ProjectDbContext())
            {
                IQueryable<Oddments> oddments = dbContext.Oddments;


                if (!string.IsNullOrEmpty(request.Name))

                    oddments = oddments.Where(u => u.Name.Contains(request.Name));

                //if (!string.IsNullOrEmpty(request.Toolname))
                //    oddments = oddments.Where(u => u.Toolname.Contains(request.Toolname));

                //if (!string.IsNullOrEmpty(request.obb))
                //    oddments = oddments.Where(u => u.obb.Contains(request.obb));

                //if (!string.IsNullOrEmpty(request.Way))
                //    oddments = oddments.Where(u => u.Way.Contains(request.Way));

                return oddments.OrderByDescending(u => u.ID).ToPagedList(request.PageIndex, request.PageSize);
            }
        }
Exemple #11
0
 public void DeleteFile(List<int> ids)
 {
     using (var dbContext = new ProjectDbContext())
     {
         dbContext.Files.Where(u => ids.Contains(u.ID)).Delete();
     }
 }
Exemple #12
0
        public IEnumerable<Files> GetFileList(FileRequest request = null)
        {
            request = request ?? new FileRequest();
            using (var dbContext = new ProjectDbContext())
            {
                IQueryable<Files> files = dbContext.Files;


                if (!string.IsNullOrEmpty(request.Name))
                    files = files.Where(u => u.Name.Contains(request.Name));

               
                if (!string.IsNullOrEmpty(request.Type))
                    files = files.Where(u => u.Type.Contains(request.Type));

                return files.OrderByDescending(u => u.ID).ToPagedList(request.PageIndex, request.PageSize);
            }
        }
Exemple #13
0
 public void DeleteInsOverhead(List<int> ids)
 {
     using (var dbContext = new ProjectDbContext())
     {
         dbContext.InsOverheads.Where(u => ids.Contains(u.ID)).Delete();
     }
 }
Exemple #14
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);
                }
            }
        }
Exemple #15
0
 public IEnumerable<InsLaborCost> GetInsLaborCostList(InsLaborCostRequest request = null)
 {
     request = request ?? new InsLaborCostRequest();
     using (var dbContext = new ProjectDbContext())
     {
         IQueryable<InsLaborCost> InsLaborCost = dbContext.InsLaborCosts.Include("ProjectBasedata") ;
        
         //if (!string.IsNullOrEmpty(request.ProjectBasedataID))
             if (request.ProjectBasedataID>0)
             InsLaborCost = InsLaborCost.Where(d => d.ProjectBasedataID == request.ProjectBasedataID);
         
         return InsLaborCost.OrderByDescending(u => u.ID).ToPagedList(request.PageIndex, request.PageSize);
     }
 }
Exemple #16
0
        public InsLaborCost GetInsLaborCost(int id)
        {
            using (var dbContext = new ProjectDbContext())
            {
                  //dbContext.Find.InsLaborCosts.Where((d => d.ID == id);
                //var q = from L in dbContext.InsLaborCosts
                //        join P in dbContext.ProjectBasedatas on L.ProjectBasedataID equals P.ID
                //        //orderby n.AddTime descending
                //        select L;
                       
                //return q.ToList();
                var model = dbContext.Find<InsLaborCost>(id);
                model.ProjectBasedata = GetProjectBasedata(model.ProjectBasedataID);
                return model;

               
              
            }
        }
Exemple #17
0
        public void SaveInsBudget(InsBudgetInfo insbudget)
        {
            using (var dbContext = new ProjectDbContext())
            {

                if (insbudget.ID > 0)
                {
                    dbContext.Update<InsBudgetInfo>(insbudget);
                }
                else
                {
                    dbContext.Insert<InsBudgetInfo>(insbudget);
                }
            }
        }
Exemple #18
0
        public void SaveAccounting(Accounting accounting)
        {
            using (var dbContext = new ProjectDbContext())
            {

                if (accounting.ID > 0)
                {

                    dbContext.Update<Accounting>(accounting);
                }
                else
                {
                    dbContext.Insert<Accounting>(accounting);
                }
            }
        }
Exemple #19
0
        public IEnumerable<Accounting> GetAccountingList(AccountingRequest request = null)
        {
            request = request ?? new AccountingRequest();
            using (var dbContext = new ProjectDbContext())
            {
                IQueryable<Accounting> Accounting = dbContext.Accountings;

                if (!string.IsNullOrEmpty(request.Name))
                    Accounting = Accounting.Where(u => u.Name.Contains(request.Name));

                return Accounting.OrderByDescending(u => u.ID).ToPagedList(request.PageIndex, request.PageSize);
            }
        }
Exemple #20
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);
                }
            }
        }
Exemple #21
0
        public void SaveBudget(BudgetInfo budget)
        {
            using (var dbContext = new ProjectDbContext())
            {

                if (budget.ID >0)
                {
                    dbContext.Update<BudgetInfo>(budget);
                }
                else
                {
                    dbContext.Insert<BudgetInfo>(budget);
                }
            }
        }
Exemple #22
0
 public InsMachineryCost GetInsMachineryCost(int id)
 {
     using (var dbContext = new ProjectDbContext())
     {
         var model = dbContext.Find<InsMachineryCost>(id);
         model.ProjectBasedata = GetProjectBasedata(model.ProjectBasedataID);
         return model;
         //return dbContext.Find<InsMachineryCost>(id);
     }
 }
Exemple #23
0
 //--------------------------资产管理-----------------------------------
 #region Files CURD
 public Files GetFile(int id)
 {
     using (var dbContext = new ProjectDbContext())
     {
         return dbContext.Find<Files>(id);
     }
 }
Exemple #24
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);
                }
            }
        }
Exemple #25
0
 public void SaveFile(Files file)
 {
     using (var dbContext = new ProjectDbContext())
     {
         if (file.ID > 0)
         {
             dbContext.Update<Files>(file);
         }
         else
         {
             dbContext.Insert<Files>(file);
         }
     }
 }
Exemple #26
0
 public void DeleteInsMachineryCost(List<int> ids)
 {
     using (var dbContext = new ProjectDbContext())
     {
         dbContext.InsMachineryCosts.Where(u => ids.Contains(u.ID)).Delete();
     }
 }
Exemple #27
0
 public Oddments GetOddments(int id)
 {
     using (var dbContext = new ProjectDbContext())
     {
         return dbContext.Find<Oddments>(id);
     }
 }
Exemple #28
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);
                }
            }
        }
Exemple #29
0
 public void SaveOddments(Oddments oddments)
 {
     using (var dbContext = new ProjectDbContext())
     {
         if (oddments.ID > 0)
         {
             dbContext.Update<Oddments>(oddments);
         }
         else
         {
             dbContext.Insert<Oddments>(oddments);
         }
     }
 }
Exemple #30
0
 public void DeleteAccountant(List<int> ids)
 {
     using (var dbContext = new ProjectDbContext())
     {
         dbContext.Accountants.Where(u => ids.Contains(u.ID)).Delete();
     }
 }