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 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 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 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 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 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(); } }