public IEnumerable <UserLogin> Login(UserLogin userLogin)
 {
     using (var ctx = new SystemCompanyEntities())
     {
         return(ctx.UserLogin.Where(u => u.UserName == userLogin.UserName && u.Password == userLogin.Password).ToList());
     }
 }
 public IEnumerable<View_Project_Company> ViewProjectCompany()
 {
     using (var ctx = new SystemCompanyEntities())
     {
         return ctx.View_Project_Company.ToList();
     }
 }
 public IEnumerable <UserLogin> ViewingUsers()
 {
     using (var ctx = new SystemCompanyEntities())
     {
         return(ctx.UserLogin.ToList());
     }
 }
        public void UpdateProduct(Products newProduct)
        {
            using (var ctx = new SystemCompanyEntities())
            {
                Products product = ctx.Products.First(e => e.idProduct == newProduct.idProduct);
                if (product.ProductName != newProduct.ProductName ||
                    product.ProductDiscription != newProduct.ProductDiscription ||
                    product.ProductDate != newProduct.ProductDate ||
                    product.ProductCount != newProduct.ProductCount ||
                    product.ProductCostPrice != newProduct.ProductCostPrice ||
                    product.ProductCustomers != newProduct.ProductCustomers)
                {
                    AuditDataServices.Instance.InsertAudit(newProduct.idProduct, 0, 0, "products", product.ProductName, "Update");
                    AuditDataServices.Instance.InsertAudit(newProduct.idProduct, 0, 0, "products", product.ProductDiscription, "Update");
                    AuditDataServices.Instance.InsertAudit(newProduct.idProduct, 0, 0, "products", Convert.ToString(product.ProductDate), "Update");
                    AuditDataServices.Instance.InsertAudit(newProduct.idProduct, 0, 0, "products", Convert.ToString(product.ProductCount), "Update");
                    AuditDataServices.Instance.InsertAudit(newProduct.idProduct, 0, 0, "products", Convert.ToString(newProduct.ProductCostPrice), "Update");
                    AuditDataServices.Instance.InsertAudit(newProduct.idProduct, 0, 0, "products", Convert.ToString(newProduct.ProductCustomers), "Update");

                    product.ProductCustomers   = newProduct.ProductCustomers;
                    product.ProductName        = newProduct.ProductName;
                    product.ProductDiscription = newProduct.ProductDiscription;
                    product.ProductDate        = newProduct.ProductDate;
                    product.ProductCount       = newProduct.ProductCount;
                    product.ProductCostPrice   = newProduct.ProductCostPrice;
                    ctx.SaveChanges();
                }
            }
        }
 public IEnumerable<ProjectCompany> ViewingProjectToCompany()
 {
     using (var ctx = new SystemCompanyEntities())
     {
         return ctx.ProjectCompanies.ToList();
     }
 }
 public void UpdateProjectToCompany(ProjectCompany projectCompany, DateProjectCompany dateProjectCompany)
 {
     using (var ctx = new SystemCompanyEntities())
     {
         var PC =
             ctx.ProjectCompanies.First(
                 pC => pC.idProject == projectCompany.idProject && pC.idCompany == projectCompany.idCompany);
         PC.idProject = projectCompany.idProject;
         PC.idCompany = projectCompany.idCompany;
         PC.priceType = projectCompany.priceType;
         PC.paid = projectCompany.paid;
         PC.destination = projectCompany.destination;
         PC.discriptions = projectCompany.discriptions;
         ctx.SaveChanges();
         var DPC =
             ctx.DateProjectCompany.First(
                 dpC =>
                 dpC.idProject == dateProjectCompany.idProject && dpC.idCompany == dateProjectCompany.idCompany);
         DPC.idCompany = dateProjectCompany.idCompany;
         DPC.idProject = dateProjectCompany.idProject;
         DPC.DateStartProject = dateProjectCompany.DateStartProject;
         DPC.DateFinishProject = dateProjectCompany.DateFinishProject;
         ctx.SaveChanges();
     }
 }
Exemplo n.º 7
0
        public IEnumerable <Viewing_Service_Calls> GetServiceCallsBetweenDate(ServiceCall serviceCall)
        {
            using (var ctx = new SystemCompanyEntities())
            {
                // var query3 =

                return(ctx.Viewing_Service_Calls.Where(
                           t => t.dateOpenCalls > serviceCall.dateOpenCalls && t.dateOpenCalls < DateTime.Now).ToList());
                //  return  ctx.ServiceCalls.Include("Company").Include("Priority").Where(
                //     t => t.dateOpenCalls > serviceCall.dateOpenCalls && t.dateOpenCalls < DateTime.Now).ToList();

                //.Select
                //        (item => new
                //        {
                //            companyName = item.Company.companyName,
                //            dateOpenCalls = item.dateOpenCalls.Value,
                //            discriptions = item.discriptions,
                //            TypePriority = item.Priority.TypePriority,
                //            idCallsServices = item.idCallsServices,
                //            idCompany = item.idCompany,
                //            idPriority = item.idPriority
                //        }
                //        ).ToList();
                //  var query = mDB.ServiceCalls.Where(t => t.dateOpenCalls > serviceCall.dateOpenCalls && t.dateOpenCalls < DateTime.Now).ToList();
                //return query3.Select(item => new ServiceCall
                //{
                //    idCompany = item.idCompany,
                //    dateOpenCalls = item.dateOpenCalls,
                //    discriptions = item.discriptions,
                //    idCallsServices = item.idCallsServices,
                //    idPriority = item.idPriority
                //}).ToList();
            }
        }
 public IEnumerable <project> ViewingProject()
 {
     using (var ctx = new SystemCompanyEntities())
     {
         return(ctx.projects.ToList());
     }
 }
Exemplo n.º 9
0
 public IEnumerable <Priority> ViewingPriority()
 {
     using (var ctx = new SystemCompanyEntities())
     {
         return(ctx.Priorities.ToList());
     }
 }
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public IEnumerable <Service> ViewingServices()
 {
     using (var ctx = new SystemCompanyEntities())
     {
         return(ctx.Services.ToList());
     }
 }
 public void UpdateServiceToCompany(ServicesCompany newServiceToCompany)
 {
     using (var ctx = new SystemCompanyEntities())
     {
         var serviceToCompany =
             ctx.ServicesCompanies.First(
                 e => e.idService == newServiceToCompany.idService && e.idCompany == newServiceToCompany.idCompany);
         if (serviceToCompany.startdate != newServiceToCompany.startdate ||
             serviceToCompany.enddate != newServiceToCompany.enddate ||
             serviceToCompany.price != newServiceToCompany.price ||
             serviceToCompany.priceCost != newServiceToCompany.priceCost ||
             serviceToCompany.paid != newServiceToCompany.paid)
         {
             serviceToCompany.startdate = newServiceToCompany.startdate;
             serviceToCompany.enddate   = newServiceToCompany.enddate;
             serviceToCompany.price     = newServiceToCompany.price;
             if (newServiceToCompany.priceCost == string.Empty)
             {
                 newServiceToCompany.priceCost = "0";
             }
             serviceToCompany.priceCost = newServiceToCompany.priceCost;
             serviceToCompany.paid      = newServiceToCompany.paid;
             ctx.SaveChanges();
         }
     }
 }
Exemplo n.º 12
0
        public void UpdateCompany(Company newCompany)
        {
            using (var ctx = new SystemCompanyEntities())
            {
                var company = ctx.Companys.First(e => e.idCompany == newCompany.idCompany);

                if (company.contactName != newCompany.contactName ||
                    company.address != newCompany.address ||
                    company.companyName != newCompany.companyName ||
                    company.Phone != newCompany.Phone ||
                    company.mobilePhone != newCompany.mobilePhone ||
                    company.city != newCompany.city ||
                    company.FAX != newCompany.FAX ||
                    company.email != newCompany.email ||
                    company.ZIP != newCompany.ZIP ||
                    company.PostalNum != newCompany.PostalNum ||
                    company.paymentTerms != newCompany.paymentTerms)
                {
                    company.contactName  = newCompany.contactName;
                    company.address      = newCompany.address;
                    company.companyName  = newCompany.companyName;
                    company.Phone        = newCompany.Phone;
                    company.mobilePhone  = newCompany.mobilePhone;
                    company.city         = newCompany.city;
                    company.FAX          = newCompany.FAX;
                    company.email        = newCompany.email;
                    company.ZIP          = newCompany.ZIP;
                    company.PostalNum    = newCompany.PostalNum;
                    company.paymentTerms = newCompany.paymentTerms;
                    ctx.SaveChanges();
                }
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// ViewingCompanys()
        /// </summary>
        /// <returns></returns>

        public IEnumerable <Company> ViewingCompanys()
        {
            using (var ctx = new SystemCompanyEntities())
            {
                return(ctx.Companys.ToList());
            }
        }
        /*    public List<ServicesCompany> GetIdServiceAndIdCompny()
         *  {
         *      var query = _mDb.ServicesCompanies.Select(s => new
         *      {
         *          s.idService,
         *          s.idCompany,
         *      }).ToList();
         *
         *      return query.Select(serviceCompany => new ServicesCompany
         *      {
         *          idService = serviceCompany.idService,
         *          idCompany = serviceCompany.idCompany
         *      }).ToList();
         *  }*/

        public void InsertServiceToCompany(ServicesCompany serviceToCompany)
        {
            using (var ctx = new SystemCompanyEntities())
            {
                ctx.AddToServicesCompanies(serviceToCompany);
                ctx.SaveChanges();
            }
        }
 public IEnumerable <View_Services_Company> ViewingServicesToCompanys()
 {
     using (var ctx = new SystemCompanyEntities())
     {
         return(ctx.View_Services_Company.ToList());
         //  return ctx.ServicesCompanies.Include("Company").Include("Service").ToList();
     }
 }
Exemplo n.º 16
0
 public void InsertServiceCall(ServiceCall serviceCall)
 {
     using (var ctx = new SystemCompanyEntities())
     {
         ctx.AddToServiceCalls(serviceCall);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 17
0
 private void InsertDataToAudit(SysAudit audit)
 {
     using (var ctx = new SystemCompanyEntities())
     {
         ctx.AddToSysAudit(audit);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 18
0
 public void InsertCompany(Company company)
 {
     using (var ctx = new SystemCompanyEntities())
     {
         ctx.AddToCompanys(company);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 19
0
 public Company GetCompanyById(Company company)
 {
     using (var ctx = new SystemCompanyEntities())
     {
         var companyToDelete = ctx.Companys.First(e => e.idCompany == company.idCompany);
         return(companyToDelete);
     }
 }
 public void InsertProduct(Products products)
 {
     using (var ctx = new SystemCompanyEntities())
     {
         ctx.AddToProducts(products);
         ctx.SaveChanges();
     }
 }
 public void InsertUser(UserLogin login)
 {
     using (var ctx = new SystemCompanyEntities())
     {
         ctx.AddToUserLogin(login);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 22
0
 public void InsertPriority(Priority priority)
 {
     using (var ctx = new SystemCompanyEntities())
     {
         ctx.AddToPriorities(priority);
         ctx.SaveChanges();
     }
 }
 public void InsertProject(project project)
 {
     using (var ctx = new SystemCompanyEntities())
     {
         ctx.AddToprojects(project);
         ctx.SaveChanges();
     }
 }
 public IEnumerable <UserLogin> CheckUserName(UserLogin userLogin)
 {
     using (var ctx = new SystemCompanyEntities())
     {
         return(from c in ctx.UserLogin
                where c.UserName == userLogin.UserName
                select c);
     }
 }
Exemplo n.º 25
0
        public IEnumerable <Viewing_Service_Calls> ViewingServiceCalls()
        {
            using (var ctx = new SystemCompanyEntities())
            {
                return(ctx.Viewing_Service_Calls.ToList());

                //return ctx.ServiceCalls.Include("Company").Include("Priority").ToList();
            }
        }
 public void InsertProjectToCompany(ProjectCompany projectCompany, DateProjectCompany dateProjectCompany)
 {
     using (var ctx = new SystemCompanyEntities())
     {
         ctx.AddToProjectCompanies(projectCompany);
         ctx.SaveChanges();
         ctx.AddToDateProjectCompany(dateProjectCompany);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 27
0
 public void DeletePriority(Priority priority)
 {
     using (var ctx = new SystemCompanyEntities())
     {
         var priorityToDelete = ctx.Priorities.First(e => e.idPriority == priority.idPriority);
         AuditDataServices.Instance.InsertAudit(priorityToDelete.idPriority, 0, 0, "Priorities", priorityToDelete.TypePriority, "Delete");
         ctx.DeleteObject(priorityToDelete);
         ctx.SaveChanges();
     }
 }
 public void DeleteProject(project project)
 {
     using (var ctx = new SystemCompanyEntities())
     {
         project projectToDelete = ctx.projects.First(e => e.idProject == project.idProject);
         AuditDataServices.Instance.InsertAudit(projectToDelete.idProject, 0, 0, "projects", projectToDelete.projectName, "Delete");
         AuditDataServices.Instance.InsertAudit(projectToDelete.idProject, 0, 0, "projects", projectToDelete.projectDescription, "Delete");
         ctx.DeleteObject(projectToDelete);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 29
0
        public void DeleteServiceCall(ServiceCall serviceCall)
        {
            using (var ctx = new SystemCompanyEntities())
            {
                var serviceCallToDelete = ctx.ServiceCalls.First(e => e.idCallsServices == serviceCall.idCallsServices);

                AuditDataServices.Instance.InsertAudit(serviceCallToDelete.idCallsServices, serviceCallToDelete.idCompany, 0, "ServiceCalls", Convert.ToString(serviceCallToDelete.dateOpenCalls), "Delete");
                AuditDataServices.Instance.InsertAudit(serviceCallToDelete.idCallsServices, serviceCallToDelete.idCompany, 0, "ServiceCalls", serviceCallToDelete.discriptions, "Delete");
                AuditDataServices.Instance.InsertAudit(serviceCallToDelete.idCallsServices, serviceCallToDelete.idCompany, 0, "ServiceCalls", Convert.ToString(serviceCallToDelete.idPriority), "Delete");

                ctx.DeleteObject(serviceCallToDelete);
                ctx.SaveChanges();
            }
        }
 public void DeleteProduct(Products products)
 {
     using (var ctx = new SystemCompanyEntities())
     {
         Products ProductsToDelete = ctx.Products.First(e => e.idProduct == products.idProduct);
         AuditDataServices.Instance.InsertAudit(ProductsToDelete.idProduct, 0, 0, "products", ProductsToDelete.ProductName, "Delete");
         AuditDataServices.Instance.InsertAudit(ProductsToDelete.idProduct, 0, 0, "products", Convert.ToString(ProductsToDelete.ProductCostPrice), "Delete");
         AuditDataServices.Instance.InsertAudit(ProductsToDelete.idProduct, 0, 0, "products", Convert.ToString(ProductsToDelete.ProductCount), "Delete");
         AuditDataServices.Instance.InsertAudit(ProductsToDelete.idProduct, 0, 0, "products", Convert.ToString(ProductsToDelete.ProductDate), "Delete");
         AuditDataServices.Instance.InsertAudit(ProductsToDelete.idProduct, 0, 0, "products", ProductsToDelete.ProductDiscription, "Delete");
         ctx.DeleteObject(ProductsToDelete);
         ctx.SaveChanges();
     }
 }