public GetLevelConditionResponse GetLevelCondition(GetRequest2 request) { GetLevelConditionResponse response = new GetLevelConditionResponse(); try { LevelCondition levelCondition = new LevelCondition(); LevelConditionView levelConditionView = levelCondition.ConvertToLevelConditionView(); Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); Criterion criteria1 = new Criterion("LevelID", request.ID1, CriteriaOperator.Equal); Criterion criteria2 = new Criterion("ConditionID", request.ID2, CriteriaOperator.Equal); query.Add(criteria1); query.Add(criteria2); levelCondition = _levelConditionRepository.FindBy(query).FirstOrDefault(); if (levelCondition != null) { levelConditionView = levelCondition.ConvertToLevelConditionView(); } response.LevelConditionView = levelConditionView; } catch (Exception ex) { } return(response); }
public GetGeneralResponse <IEnumerable <NetworkCenterPriorityView> > GetNetworkCenter(Guid CenterID) { GetGeneralResponse <IEnumerable <NetworkCenterPriorityView> > response = new GetGeneralResponse <IEnumerable <NetworkCenterPriorityView> >(); try { Query query = new Query(); Criterion ctr = new Criterion("Center.ID", CenterID, CriteriaOperator.Equal); query.Add(ctr); Response <NetworkCenterPriority> networkCenterPriorities = _networkCenterPriorityRepository.FindByQuery(query); response.data = networkCenterPriorities.data.ConvertToNetworkCenterPriorityViews(); response.totalCount = networkCenterPriorities.totalCount; } catch (Exception ex) { response.ErrorMessages.Add(ex.Message); if (ex.InnerException != null) { response.ErrorMessages.Add(ex.InnerException.Message); } } return(response); }
public GetCenterResponse GetCenter(GetRequest request) { GetCenterResponse response = new GetCenterResponse(); try { Center center = _centerRepository.FindBy(request.ID); if (center != null) { CenterView centerView = center.ConvertToCenterView(); Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); Criterion criteria = new Criterion("Center.ID", center.ID, CriteriaOperator.Equal); query.Add(criteria); IEnumerable <NetworkCenter> networkCenters = _networkCenterRepository.FindBy(query); IEnumerable <NetworkCenterView> networkCenterViews = networkCenters.ConvertToNetworkCenterViews(); centerView.NetworkCenters = networkCenterViews; response.CenterView = centerView; } } catch (Exception ex) { throw; } return(response); }
public GeneralResponse DeleteLevelCondition(DeleteRequest2 request) { GeneralResponse response = new GeneralResponse(); LevelCondition levelCondition = new LevelCondition(); Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); Criterion criterion1 = new Criterion("Level.ID", request.ID1, CriteriaOperator.Equal); Criterion criterion2 = new Criterion("Condition.ID", request.ID2, CriteriaOperator.Equal); query.Add(criterion1); query.Add(criterion2); levelCondition = _levelConditionRepository.FindBy(query).FirstOrDefault(); if (levelCondition != null) { try { _levelConditionRepository.Remove(levelCondition); _uow.Commit(); ////response.success = true; } catch (Exception ex) { response.ErrorMessages.Add(ex.Message); } } return(response); }
public GeneralResponse DeleteCenter(IEnumerable <DeleteRequest> requests) { GeneralResponse response = new GeneralResponse(); foreach (var request in requests) { Center center = new Center(); center = _centerRepository.FindBy(request.ID); if (center != null) { try { #region Remove Dependencies Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); Criterion criterion = new Criterion("Center.ID", center.ID, CriteriaOperator.Equal); query.Add(criterion); IEnumerable <Code> codesOfThisCenter = _codeRepository.FindBy(query); if (codesOfThisCenter != null) { _codeRepository.Remove(codesOfThisCenter); } Infrastructure.Querying.Query query2 = new Infrastructure.Querying.Query(); Criterion criterion2 = new Criterion("Center.ID", center.ID, CriteriaOperator.Equal); query.Add(criterion); IEnumerable <NetworkCenter> networkCenters = _networkCenterRepository.FindBy(query); if (networkCenters != null) { _networkCenterRepository.Remove(networkCenters); } _uow.Commit(); #endregion _centerRepository.Remove(center); _uow.Commit(); } catch (Exception ex) { response.ErrorMessages.Add(ex.Message); if (ex.InnerException != null) { //response.ErrorMessages.Add("INNER EX: " + ex.InnerException.Message); response.ErrorMessages.Add("این مرکز شامل یک یا تعدادی مشتری ثبت شده میباشد"); } return(response); } } else { response.ErrorMessages.Add("NoItemToDeleteKey"); return(response); } } return(response); }
public GetGeneralResponse <IEnumerable <SupportView> > GetSupports(int pageSize, int pageNumber, Guid customerID, IList <Sort> sort) { GetGeneralResponse <IEnumerable <SupportView> > response = new GetGeneralResponse <IEnumerable <SupportView> >(); try { Query query = new Query(); Criterion CustomerIDCriteria = new Criterion("Customer.ID", customerID, CriteriaOperator.Equal); query.Add(CustomerIDCriteria); int index = (pageNumber - 1) * pageSize; int count = pageSize; Response <Support> supports = _supportRepository.FindByQuery(query, sort); response.data = supports.data.ConvertToSupportViews(); response.totalCount = supports.totalCount; } catch (Exception) { throw; } return(response); }
public GetGeneralResponse <IEnumerable <ProductView> > GetProducts(int PageSize, int PageNumber) { GetGeneralResponse <IEnumerable <ProductView> > response = new GetGeneralResponse <IEnumerable <ProductView> >(); try { int index = (PageNumber - 1) * PageSize; int count = PageSize; Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); Response <Product> Products = new Response <Product>(); Products = _productRepository.FindAll(index, count); response.data = Products.data.ConvertToProductViews(); response.totalCount = Products.totalCount; return(response); } catch (Exception ex) { response.ErrorMessages.Add(ex.Message); if (ex.InnerException != null) { response.ErrorMessages.Add(ex.InnerException.Message); } return(response); } }
public GetGeneralResponse <IEnumerable <MoneyAccountView> > GetMoneyAccounts(bool isReceipt, int pageSize, int pageNumber) { GetGeneralResponse <IEnumerable <MoneyAccountView> > response = new GetGeneralResponse <IEnumerable <MoneyAccountView> >(); try { int index = (pageNumber - 1) * pageSize; int count = pageSize; Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); string param = isReceipt ? "Receipt" : "Pay"; Criterion criteria = new Criterion(param, true, CriteriaOperator.Equal); query.Add(criteria); Response <MoneyAccount> moneyAccounts = _moneyAccountRepository.FindBy(query, index, count); response.data = moneyAccounts.data.ConvertToMoneyAccountViews().OrderBy(x => x.SortOrder); response.totalCount = moneyAccounts.totalCount; } catch (Exception ex) { } return(response); }
public GetGeneralResponse <FiscalView> GetFollowUpNumber(int FollowNumber) { GetGeneralResponse <FiscalView> response = new GetGeneralResponse <FiscalView>(); try { Infrastructure.Querying.Query query = new Query(); Criterion criteria = new Criterion("FollowNumber", FollowNumber, CriteriaOperator.Equal); query.Add(criteria); Fiscal fiscal = _fiscalRepository.FindBy(query).First(); response.data = fiscal.ConvertToFiscalView(); } catch (Exception ex) { response.ErrorMessages.Add(ex.Message); if (ex.InnerException != null) { response.ErrorMessages.Add(ex.InnerException.Message); } } return(response); }
public GeneralResponse DeleteQueryEmployees(IEnumerable <QueryEmployeeDeleteRequest> requests) { GeneralResponse response = new GeneralResponse(); try { foreach (QueryEmployeeDeleteRequest request in requests) { Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); Criterion criteriaQueryID = new Criterion("Query.ID", request.QueryID, CriteriaOperator.Equal); query.Add(criteriaQueryID); Criterion criteriaEmployeeID = new Criterion("Employee.ID", request.EmployeeID, CriteriaOperator.Equal); query.Add(criteriaEmployeeID); QueryEmployee queryemployee = new QueryEmployee(); queryemployee = _queryEmployeeRepository.FindBy(query).FirstOrDefault(); _queryEmployeeRepository.Remove(queryemployee); } _uow.Commit(); } catch (Exception ex) { response.ErrorMessages.Add(ex.Message); if (ex.InnerException != null) { response.ErrorMessages.Add(ex.InnerException.Message); } } return(response); }
public GetFiscalsResponse GetFiscalsOfCustomer(AjaxGetRequest request, Guid customerID) { GetFiscalsResponse response = new GetFiscalsResponse(); try { int index = (request.PageNumber - 1) * request.PageSize; int count = request.PageSize; Query query = new Query(); Criterion criteria = new Criterion("Customer.ID", customerID, CriteriaOperator.Equal); query.Add(criteria); Response <Fiscal> fiscalsResponse = _fiscalRepository.FindBy(query, index, count); IEnumerable <FiscalView> fiscals = fiscalsResponse.data.ConvertToFiscalViews(); response.FiscalViews = fiscals; response.Count = fiscalsResponse.totalCount; } catch (Exception ex) { throw; } return(response); }
//public GetDocumentsResponse GetDocuments() //{ // GetDocumentsResponse response = new GetDocumentsResponse(); // try // { // IEnumerable<DocumentView> documents = _documentRepository.FindAll() // .ConvertToDocumentViews(); // response.DocumentViews = documents; // } // catch (Exception ex) // { // } // return response; //} public GetDocumentsResponse GetDocumentsBy(Guid customerID, IList <Sort> sort) { GetDocumentsResponse response = new GetDocumentsResponse(); try { Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); Criterion criterion = new Criterion("Customer.ID", customerID, CriteriaOperator.Equal); query.Add(criterion); Response <Document> documents = _documentRepository.FindBy(query, -1, -1, sort); IEnumerable <DocumentView> documentViews = documents.data.ConvertToDocumentViews(); // اصلاح آدرس عکسها و پاس دادن آدرس جدید foreach (var document in documentViews) { document.Photo = document.Photo.Replace(@"\", "/").Substring(document.Photo.IndexOf("data"));; } response.DocumentViews = documentViews; } catch (Exception ex) { } return(response); }
public GeneralResponse DeleteMoneyAccountEmployee(Guid moneyAccountID, Guid employeeID) { GeneralResponse response = new GeneralResponse(); Infrastructure.Querying.Query moneyAccount = new Infrastructure.Querying.Query(); Criterion criteria1 = new Criterion("MoneyAccount.ID", moneyAccountID, CriteriaOperator.Equal); Criterion criteria2 = new Criterion("Employee.ID", employeeID, CriteriaOperator.Equal); moneyAccount.Add(criteria1); moneyAccount.Add(criteria2); MoneyAccountEmployee moneyAccountEmployee = _moneyAccountEmployeeRepository.FindBy(moneyAccount).FirstOrDefault(); if (moneyAccountEmployee != null) { try { _moneyAccountEmployeeRepository.Remove(moneyAccountEmployee); _uow.Commit(); ////response.success = true; } catch (Exception ex) { response.ErrorMessages.Add(ex.Message); } } return(response); }
public GetEmployeesResponse GetInstallExprets() { GetEmployeesResponse response = new GetEmployeesResponse(); try { Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); Criterion criterion = new Criterion("InstallExpert", true, CriteriaOperator.Equal); query.Add(criterion); IEnumerable <EmployeeView> employees = _employeeRepository.FindBy(query) .ConvertToEmployeeViews(); foreach (var item in employees) { item.Permissions = null; item.Queues = null; } response.EmployeeViews = employees; } catch (Exception ex) { throw; } return(response); }
public GetGeneralResponse <IEnumerable <NoteView> > GetNotes(Guid customerID, int pageSize, int pageNumber) { GetGeneralResponse <IEnumerable <NoteView> > response = new GetGeneralResponse <IEnumerable <NoteView> >(); try { int index = (pageNumber - 1) * pageSize; int count = pageSize; Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); Criterion criteria = new Criterion("Customer.ID", customerID, CriteriaOperator.Equal); query.Add(criteria); Response <Note> notes = _noteRepository.FindBy(query, index, count); response.data = notes.data.ConvertToNoteViews(); response.totalCount = notes.totalCount; } catch (Exception ex) { } return(response); }
public GetNetworkCenterResponse GetNetworkCenter(GetRequest2 request) { GetNetworkCenterResponse response = new GetNetworkCenterResponse(); try { NetworkCenter networkCenter = new NetworkCenter(); NetworkCenterView networkCenterView = networkCenter.ConvertToNetworkCenterView(); Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); Criterion criteria1 = new Criterion("Network.ID", request.ID1, CriteriaOperator.Equal); Criterion criteria2 = new Criterion("Center.ID", request.ID2, CriteriaOperator.Equal); query.Add(criteria1); query.Add(criteria2); networkCenter = _networkCenterRepository.FindBy(query).FirstOrDefault(); if (networkCenter != null) { networkCenterView = networkCenter.ConvertToNetworkCenterView(); } response.NetworkCenterView = networkCenterView; } catch (Exception ex) { } return(response); }
public GeneralResponse DeleteQueryEmployee(Guid queryID, Guid employeeID) { GeneralResponse response = new GeneralResponse(); Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); Criterion criteria1 = new Criterion("Query.ID", queryID, CriteriaOperator.Equal); Criterion criteria2 = new Criterion("Employee.ID", employeeID, CriteriaOperator.Equal); query.Add(criteria1); query.Add(criteria2); QueryEmployee queryEmployee = _queryEmployeeRepository.FindBy(query).FirstOrDefault(); if (queryEmployee != null) { try { _queryEmployeeRepository.Remove(queryEmployee); _uow.Commit(); ////response.success = true; } catch (Exception ex) { response.ErrorMessages.Add(ex.Message); } } return(response); }
public GetGeneralResponse <IEnumerable <QueryEmployeeView> > GetQueryEmployees(Guid QueryID, int pageSize, int pageNumber) { GetGeneralResponse <IEnumerable <QueryEmployeeView> > response = new GetGeneralResponse <IEnumerable <QueryEmployeeView> >(); try { int index = (pageNumber - 1) * pageSize; int count = pageSize; Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); Criterion criteria = new Criterion("Query.ID", QueryID, CriteriaOperator.Equal); query.Add(criteria); IEnumerable <QueryEmployeeView> queryEmployees = _queryEmployeeRepository.FindBy(query) .ConvertToQueryEmployeeViews(); response.data = queryEmployees; } catch (Exception ex) { response.ErrorMessages.Add(ex.Message); if (ex.InnerException != null) { response.ErrorMessages.Add(ex.InnerException.Message); } } return(response); }
public GetGeneralResponse <IEnumerable <SuctionModeDetailview> > GetSuctionModeDetailBySuctionModeAll(Guid SuctionModeID, int pageSize, int pageNumber, IList <Sort> sort) { GetGeneralResponse <IEnumerable <SuctionModeDetailview> > response = new GetGeneralResponse <IEnumerable <SuctionModeDetailview> >(); try { int index = (pageNumber - 1) * pageSize; int count = pageSize; Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); if (SuctionModeID != Guid.Empty) { Criterion criteriasuctionModeID = new Criterion("SuctionMode.ID", SuctionModeID, CriteriaOperator.Equal); query.Add(criteriasuctionModeID); } Response <SuctionModeDetail> suctioModeDetailviews = _suctionModeDetailRepository.FindBy(query, index, count, sort); var temp = suctioModeDetailviews.data.Where(x => x.Discontinued != true); response.data = temp.ConvertToSuctionModeViews(); response.totalCount = temp.Count(); } catch (Exception ex) { response.ErrorMessages.Add(ex.Message); if (ex.InnerException != null) { response.ErrorMessages.Add(ex.InnerException.Message); } } return(response); }
public GetEmailsResponse GetEmails(AjaxGetRequest request, IList <Sort> sort) { GetEmailsResponse response = new GetEmailsResponse(); int pageNumber = request.PageNumber == 0 ? 1 : request.PageNumber; int pageSize = request.PageSize == 0 ? 10 : request.PageSize; int index = (pageNumber - 1) * pageSize; int count = pageSize; try { Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); Criterion criterion = new Criterion("Customer.ID", request.ID, CriteriaOperator.Equal); query.Add(criterion); Infrastructure.Domain.Response <Email> emailsResponse = _emailRepository.FindBy(query, index, count, sort); IEnumerable <EmailView> emails = emailsResponse.data.ConvertToEmailViews(); response.EmailViews = emails; response.TotalCount = emailsResponse.totalCount; } catch (Exception ex) { throw; } return(response); }
public GetProductLogsResponse GetProductLogs(Guid productID, Guid StoreID) { GetProductLogsResponse response = new GetProductLogsResponse(); try { Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); Criterion criterion = new Criterion("Product.ID", productID, CriteriaOperator.Equal); query.Add(criterion); if (StoreID != Guid.Empty) { Criterion criterionStoreID = new Criterion("Store.ID", StoreID, CriteriaOperator.Equal); query.Add(criterionStoreID); } IEnumerable <ProductLogView> productLogs = _productLogRepository.FindBy(query) .OrderByDescending(o => o.CreateDate) .ConvertToProductLogViews(); response.ProductLogViews = productLogs; } catch (Exception ex) { } return(response); }
public GetGeneralResponse <IEnumerable <ProductLogView> > GetProductLogsByProductInStore(Guid ProductID, int PageSize, int PageNumber, IList <Sort> sort) { GetGeneralResponse <IEnumerable <ProductLogView> > response = new GetGeneralResponse <IEnumerable <ProductLogView> >(); try { int index = (PageNumber - 1) * PageSize; int count = PageSize; Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); Criterion criteriaproductID = new Criterion("Product.ID", ProductID, CriteriaOperator.Equal); query.Add(criteriaproductID); Response <ProductLog> productLoges = _productLogRepository.FindBy(query, index, count, sort); productLoges.data = productLoges.data.Where(x => x.Store != null); response.data = productLoges.data.ConvertToProductLogViews(); response.totalCount = productLoges.totalCount; } catch (Exception ex) { response.ErrorMessages.Add(ex.Message); if (ex.InnerException != null) { response.ErrorMessages.Add(ex.InnerException.Message); } } return(response); }
public GetGeneralResponse <IEnumerable <ProblemView> > GetProblems(Guid customerID, int pageSize, int pageNumber, IList <Sort> sort) { GetGeneralResponse <IEnumerable <ProblemView> > response = new GetGeneralResponse <IEnumerable <ProblemView> >(); try { int index = (pageNumber - 1) * pageSize; int count = pageSize; Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); Criterion criteria = new Criterion("Customer.ID", customerID, CriteriaOperator.Equal); query.Add(criteria); Response <Problem> problems = _problemRepository.FindBy(query, index, count, sort); response.data = problems.data.ConvertToProblemViews(); response.totalCount = problems.totalCount; } catch (Exception ex) { throw; } return(response); }
public GetGeneralResponse <IEnumerable <EmployeeView> > GetEmployeesByGroup(Guid GroupID, int pageSize, int pageNumber) { GetGeneralResponse <IEnumerable <EmployeeView> > response = new GetGeneralResponse <IEnumerable <EmployeeView> >(); try { int index = (pageNumber - 1) * pageSize; int count = pageSize; // By Hojjat Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); Criterion criteria = new Criterion("Group.ID", GroupID, CriteriaOperator.Equal); query.Add(criteria); // Response <Employee> employees = _employeeRepository.FindBy(query, index, count); response.data = employees.data.ConvertToEmployeeViews(); response.totalCount = employees.totalCount; } catch (Exception ex) { throw; } return(response); }
public GetLevelLevelResponse GetLevelLevel(Guid levelID, Guid relatedLevelID) { GetLevelLevelResponse response = new GetLevelLevelResponse(); try { Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); Criterion criterion1 = new Criterion("Level.ID", levelID, CriteriaOperator.Equal); Criterion criterion2 = new Criterion("RelatedLevel.ID", relatedLevelID, CriteriaOperator.Equal); query.Add(criterion1); query.Add(criterion2); LevelLevel levelLevel = new LevelLevel(); LevelLevelView levelLevelView = levelLevel.ConvertToLevelLevelView(); levelLevel = _levelLevelRepository.FindBy(query).FirstOrDefault(); if (levelLevel != null) { levelLevelView = levelLevel.ConvertToLevelLevelView(); } response.LevelLevelView = levelLevelView; } catch (Exception ex) { } return(response); }
public GeneralResponse DeleteLevelLevels(IEnumerable <DeleteRequest2> requests) { GeneralResponse response = new GeneralResponse(); foreach (var request in requests) { Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); Criterion criterion1 = new Criterion("Level.ID", request.ID1, CriteriaOperator.Equal); Criterion criterion2 = new Criterion("RelatedLevel.ID", request.ID2, CriteriaOperator.Equal); query.Add(criterion1); query.Add(criterion2); LevelLevel levelLevel = new LevelLevel(); levelLevel = _levelLevelRepository.FindBy(query).FirstOrDefault(); if (levelLevel != null) { _levelLevelRepository.Remove(levelLevel); } } try { _uow.Commit(); ////response.success = true; } catch (Exception ex) { response.ErrorMessages.Add(ex.Message); } return(response); }
public GetGeneralResponse <IEnumerable <ProductPriceView> > GetProductPrices(Guid ProductID, int pageSize, int pageNumber, IList <Sort> sort) { GetGeneralResponse <IEnumerable <ProductPriceView> > response = new GetGeneralResponse <IEnumerable <ProductPriceView> >(); int index = (pageNumber - 1) * pageSize; int count = pageSize; try { Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); if (ProductID != Guid.Empty) { Criterion criteriaProductID = new Criterion("Product.ID", ProductID, CriteriaOperator.Equal); query.Add(criteriaProductID); } Response <ProductPrice> productPrices = _productPriceRepository.FindBy(query, index, count, sort); response.data = productPrices.data.ConvertToProductPriceViews(); response.totalCount = productPrices.totalCount; } catch (Exception ex) { response.ErrorMessages.Add(ex.Message); if (ex.InnerException != null) { response.ErrorMessages.Add(ex.InnerException.Message); } } return(response); }
public GetGeneralResponse <IEnumerable <ToDoView> > GetCreatorEmployeeToDos(Guid CreateEmployee, bool?PrimaryClosed, bool?SecondaryClosed, int pageSize, int pageNumber) { GetGeneralResponse <IEnumerable <ToDoView> > response = new GetGeneralResponse <IEnumerable <ToDoView> >(); try { int index = (pageNumber - 1) * pageSize; int count = pageSize; #region Criterias Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); Criterion criteriaEmployeeID = new Criterion("CreateEmployee.ID", CreateEmployee, CriteriaOperator.Equal); query.Add(criteriaEmployeeID); if (SecondaryClosed != null) { Criterion criteriaSecondaryClosed = new Criterion("SecondaryClosed", SecondaryClosed, CriteriaOperator.Equal); query.Add(criteriaSecondaryClosed); } if (PrimaryClosed != null) { Criterion criteriaPrimaryClosed = new Criterion("PrimaryClosed", PrimaryClosed, CriteriaOperator.Equal); query.Add(criteriaPrimaryClosed); } #endregion Response <ToDoResult> toDoResults = _toDoResultRepository.FindBy(query, -1, -1); if (count != -1) { response.data = toDoResults.data.Select(w => w.ToDo).Distinct().ConvertToToDoViews().Skip(index).Take(count); } else { response.data = toDoResults.data.Select(w => w.ToDo).Distinct().ConvertToToDoViews(); } response.totalCount = response.data.Count(); foreach (ToDoView toDoResult in response.data) { toDoResult.Attachment = toDoResult.Attachment.Replace(@"\", "/").Substring(toDoResult.Attachment.IndexOf("data"));; } } catch (Exception ex) { response.ErrorMessages.Add(ex.Message); if (ex.InnerException != null) { response.ErrorMessages.Add(ex.InnerException.Message); } } return(response); }
public GetGeneralResponse <IEnumerable <GroupView> > GetChildGroups(Guid GroupID) { GetGeneralResponse <IEnumerable <GroupView> > response = new GetGeneralResponse <IEnumerable <GroupView> >(); Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); Criterion ParentGroupID = new Criterion("ParentGroup.ID", GroupID, CriteriaOperator.Equal); Response <Group> groupViews = _groupRepository.FindBy(query, -1, -1); response.data = groupViews.data.ConvertToGroupViews().Where(x => x.ParentGroupID == GroupID); response.totalCount = groupViews.totalCount; return(response); }
public GeneralResponse ChangeCenter(Guid ID, Guid CenterID) { GeneralResponse response = new GeneralResponse(); try { Code code = _codeRepository.FindBy(ID); if (code != null) { Guid centerID = code.Center.ID; Infrastructure.Querying.Query query = new Infrastructure.Querying.Query(); Criterion ctr = new Criterion("Center.ID", centerID, CriteriaOperator.Equal); query.Add(ctr); IEnumerable <Customer> customers = _customerRepository.FindBy(query); Center center = _centerRepository.FindBy(CenterID); code.Center = center; _codeRepository.Save(code); _uow.Commit(); foreach (var customer in customers) { if (customer.ADSLPhone.Length > 5) { if (customer.ADSLPhone.Substring(0, 5) == code.CodeName) { customer.Center = center; _customerRepository.Save(customer); } } } _uow.Commit(); } } catch (Exception ex) { response.ErrorMessages.Add(ex.Message); if (ex.InnerException != null) { response.ErrorMessages.Add(ex.InnerException.Message); } } return(response); }