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(); } }
public void InsertProjectToCompany(ProjectCompany projectCompany, DateProjectCompany dateProjectCompany) { using (var ctx = new SystemCompanyEntities()) { ctx.AddToProjectCompanies(projectCompany); ctx.SaveChanges(); ctx.AddToDateProjectCompany(dateProjectCompany); ctx.SaveChanges(); } }
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(); } } }
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(); } } }
public void DeleteProjectToCompany(ProjectCompany projectCompany) { using (var ctx = new SystemCompanyEntities()) { var PC = ctx.ProjectCompanies.First( pC => pC.idProject == projectCompany.idProject && pC.idCompany == projectCompany.idCompany); ctx.ProjectCompanies.DeleteObject(PC); ctx.SaveChanges(); var DPC = ctx.DateProjectCompany.First( pC => pC.idProject == projectCompany.idProject && pC.idCompany == projectCompany.idCompany); ctx.DateProjectCompany.DeleteObject(DPC); ctx.SaveChanges(); } }
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(); } } }
private void InsertDataToAudit(SysAudit audit) { using (var ctx = new SystemCompanyEntities()) { ctx.AddToSysAudit(audit); ctx.SaveChanges(); } }
/* 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 void InsertCompany(Company company) { using (var ctx = new SystemCompanyEntities()) { ctx.AddToCompanys(company); ctx.SaveChanges(); } }
public void InsertProduct(Products products) { using (var ctx = new SystemCompanyEntities()) { ctx.AddToProducts(products); ctx.SaveChanges(); } }
public void InsertServiceCall(ServiceCall serviceCall) { using (var ctx = new SystemCompanyEntities()) { ctx.AddToServiceCalls(serviceCall); ctx.SaveChanges(); } }
public void InsertProject(project project) { using (var ctx = new SystemCompanyEntities()) { ctx.AddToprojects(project); ctx.SaveChanges(); } }
public void InsertPriority(Priority priority) { using (var ctx = new SystemCompanyEntities()) { ctx.AddToPriorities(priority); ctx.SaveChanges(); } }
public void InsertUser(UserLogin login) { using (var ctx = new SystemCompanyEntities()) { ctx.AddToUserLogin(login); ctx.SaveChanges(); } }
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(); } }
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(); } }
public void UpdateServiceCall(ServiceCall newServiceCall) { using (var ctx = new SystemCompanyEntities()) { var serviceCall = ctx.ServiceCalls.First(e => e.idCallsServices == newServiceCall.idCallsServices); if (serviceCall.discriptions != newServiceCall.discriptions || serviceCall.status != newServiceCall.status) { AuditDataServices.Instance.InsertAudit(serviceCall.idCallsServices, serviceCall.idCompany, 0, "ServiceCalls", serviceCall.discriptions, "Update"); AuditDataServices.Instance.InsertAudit(newServiceCall.idCallsServices, serviceCall.idCompany, 0, "ServiceCalls", newServiceCall.discriptions, "Update"); serviceCall.status = newServiceCall.status; serviceCall.discriptions = newServiceCall.discriptions; ctx.SaveChanges(); } } }
public void DeleteUser(UserLogin user) { using (var ctx = new SystemCompanyEntities()) { var userToDelete = ctx.UserLogin.First(e => e.idUserLogin == user.idUserLogin); AuditDataServices.Instance.InsertAudit(userToDelete.idUserLogin, 0, 0, "UserLogin", userToDelete.Password, "Delte"); AuditDataServices.Instance.InsertAudit(userToDelete.idUserLogin, 0, 0, "UserLogin", userToDelete.FirstName, "Delte"); AuditDataServices.Instance.InsertAudit(userToDelete.idUserLogin, 0, 0, "UserLogin", userToDelete.UserName, "Delte"); AuditDataServices.Instance.InsertAudit(userToDelete.idUserLogin, 0, 0, "UserLogin", userToDelete.VPermission, "Delte"); ctx.DeleteObject(userToDelete); ctx.SaveChanges(); } }
public void UpdateService(Service newService) { using (var ctx = new SystemCompanyEntities()) { var service = ctx.Services.First(e => e.idService == newService.idService); if (service.servicesName != newService.servicesName || service.serviceDescription != newService.serviceDescription) { AuditDataServices.Instance.InsertAudit(service.idService, 0, 0, "Services", service.servicesName, "Update"); AuditDataServices.Instance.InsertAudit(newService.idService, 0, 0, "Services", newService.servicesName, "Update"); service.servicesName = newService.servicesName; service.serviceDescription = newService.serviceDescription; ctx.SaveChanges(); } } }
public void DeleteService(Service idService) { using (var ctx = new SystemCompanyEntities()) { try { var service = ctx.Services.First(e => e.idService == idService.idService); AuditDataServices.Instance.InsertAudit(service.idService, 0, 0, "Services", service.servicesName, "Delete"); ctx.DeleteObject(service); ctx.SaveChanges(); } catch (ContextMarshalException) { throw; } } }
public void DeleteServiceToCompany(ServicesCompany idServiceToIdCompany) { using (var ctx = new SystemCompanyEntities()) { var serviceToCompany = ctx.ServicesCompanies.First( e => e.idService == idServiceToIdCompany.idService && e.idCompany == idServiceToIdCompany.idCompany); AuditDataServices.Instance.InsertAudit(serviceToCompany.idCompany, serviceToCompany.idService, 0, "ServicesCompanies", Convert.ToString(serviceToCompany.startdate), "Delete"); AuditDataServices.Instance.InsertAudit(serviceToCompany.idCompany, serviceToCompany.idService, 0, "ServicesCompanies", Convert.ToString(serviceToCompany.enddate), "Delete"); AuditDataServices.Instance.InsertAudit(serviceToCompany.idCompany, serviceToCompany.idService, 0, "ServicesCompanies", serviceToCompany.price, "Delete"); AuditDataServices.Instance.InsertAudit(serviceToCompany.idCompany, serviceToCompany.idService, 0, "ServicesCompanies", serviceToCompany.priceCost, "Delete"); AuditDataServices.Instance.InsertAudit(serviceToCompany.idCompany, serviceToCompany.idService, 0, "ServicesCompanies", Convert.ToString(serviceToCompany.paid), "Delete"); ctx.DeleteObject(serviceToCompany); ctx.SaveChanges(); } }
public void UpdateProject(project newProject) { using (var ctx = new SystemCompanyEntities()) { project project = ctx.projects.First(e => e.idProject == newProject.idProject); if (project.projectName != newProject.projectName || project.projectDescription != newProject.projectDescription) { AuditDataServices.Instance.InsertAudit(newProject.idProject, 0, 0, "projects", project.projectName, "Update"); AuditDataServices.Instance.InsertAudit(newProject.idProject, 0, 0, "projects", project.projectDescription, "Update"); AuditDataServices.Instance.InsertAudit(newProject.idProject, 0, 0, "projects", newProject.projectName, "Update"); AuditDataServices.Instance.InsertAudit(newProject.idProject, 0, 0, "projects", newProject.projectDescription, "Update"); project.projectName = newProject.projectName; project.projectDescription = newProject.projectDescription; ctx.SaveChanges(); } } }
public void DeleteCompany(Company company) { using (var ctx = new SystemCompanyEntities()) { var companyToDelete = ctx.Companys.First(e => e.idCompany == company.idCompany); AuditDataServices.Instance.InsertAudit(companyToDelete.idCompany, 0, 0, "Companys", companyToDelete.address, "Delete"); AuditDataServices.Instance.InsertAudit(companyToDelete.idCompany, 0, 0, "Companys", companyToDelete.city, "Delete"); AuditDataServices.Instance.InsertAudit(companyToDelete.idCompany, 0, 0, "Companys", companyToDelete.companyName, "Delete"); AuditDataServices.Instance.InsertAudit(companyToDelete.idCompany, 0, 0, "Companys", companyToDelete.companynumber, "Delete"); AuditDataServices.Instance.InsertAudit(companyToDelete.idCompany, 0, 0, "Companys", companyToDelete.contactName, "Delete"); AuditDataServices.Instance.InsertAudit(companyToDelete.idCompany, 0, 0, "Companys", companyToDelete.email, "Delete"); AuditDataServices.Instance.InsertAudit(companyToDelete.idCompany, 0, 0, "Companys", companyToDelete.FAX, "Delete"); AuditDataServices.Instance.InsertAudit(companyToDelete.idCompany, 0, 0, "Companys", companyToDelete.mobilePhone, "Delete"); AuditDataServices.Instance.InsertAudit(companyToDelete.idCompany, 0, 0, "Companys", companyToDelete.paymentTerms, "Delete"); AuditDataServices.Instance.InsertAudit(companyToDelete.idCompany, 0, 0, "Companys", companyToDelete.Phone, "Delete"); AuditDataServices.Instance.InsertAudit(companyToDelete.idCompany, 0, 0, "Companys", companyToDelete.PostalNum, "Delete"); AuditDataServices.Instance.InsertAudit(companyToDelete.idCompany, 0, 0, "Companys", companyToDelete.ZIP, "Delete"); ctx.DeleteObject(companyToDelete); ctx.SaveChanges(); } }