public AccountCaseModel GetCaseByCaseId(int caseId) { AccountCaseModel caseModel = new AccountCaseModel(); AccountCase cases = accountcaseRepository.GetAll(t => t.AccountCaseId == caseId && t.RecordDeleted == false).FirstOrDefault(); AutoMapper.Mapper.Map(cases, caseModel); return(caseModel); }
public IList <AccountCaseModel> GetCaseStatus() { IList <AccountCaseModel> caseModelList = new List <AccountCaseModel>(); IList <AccountCase> caseList = caseStatusRepository.GetAll().ToList(); AutoMapper.Mapper.Map(caseList, caseModelList); return(caseModelList); }
private bool DeleteAllAccountItems(int accountId, int userId) { //Attachements List <FileAttachment> accountFileAttachments = fileAttachmentRepository.GetAll(x => x.AccountId == accountId).ToList(); for (int i = 0; i < accountFileAttachments.Count; i++) { accountFileAttachments[i].RecordDeleted = true; } //Activities List <TaskItem> accountTaskItems = taskItemRepository.GetAll(x => x.AssociatedModuleId == (int)Utility.Enums.Module.Account && x.AssociatedModuleValue == accountId).ToList(); for (int i = 0; i < accountTaskItems.Count; i++) { accountTaskItems[i].RecordDeleted = true; accountTaskItems[i].ModifiedBy = userId; accountTaskItems[i].ModifiedDate = DateTime.UtcNow; } //SaleOrders List <SalesOrder> accountSalesOrders = salesOrderRepository.GetAll(x => x.AccountId == accountId).ToList(); for (int i = 0; i < accountSalesOrders.Count; i++) { accountSalesOrders[i].RecordDeleted = true; accountSalesOrders[i].ModifiedBy = userId; accountSalesOrders[i].ModifiedDate = DateTime.UtcNow; } //Contacts List <Contact> accountContacts = contactRepository.GetAll(x => x.AccountId == accountId).ToList(); for (int i = 0; i < accountContacts.Count; i++) { accountContacts[i].RecordDeleted = true; accountContacts[i].ModifiedBy = userId; accountContacts[i].ModifiedDate = DateTime.UtcNow; } //Cases List <AccountCase> accountCases = accountCaseRepository.GetAll(x => x.AccountId == accountId).ToList(); for (int i = 0; i < accountCases.Count; i++) { accountCases[i].RecordDeleted = true; accountCases[i].ModifiedBy = userId; accountCases[i].ModifiedDate = DateTime.UtcNow; } fileAttachmentRepository.UpdateAll(accountFileAttachments); taskItemRepository.UpdateAll(accountTaskItems); salesOrderRepository.UpdateAll(accountSalesOrders); contactRepository.UpdateAll(accountContacts); accountCaseRepository.UpdateAll(accountCases); return(true); }