public List <StoreItemCategoryObject> GetStoreItemCategoryObjects(int?itemsPerPage, int?pageNumber) { try { List <StoreItemCategory> storeItemCategoryEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; storeItemCategoryEntityList = _repository.GetWithPaging(m => m.StoreItemCategoryId, tpageNumber, tsize).ToList(); } else { storeItemCategoryEntityList = _repository.GetAll().ToList(); } if (!storeItemCategoryEntityList.Any()) { return(new List <StoreItemCategoryObject>()); } var storeItemCategoryObjList = new List <StoreItemCategoryObject>(); storeItemCategoryEntityList.ForEach(m => { var storeItemCategoryObject = ModelCrossMapper.Map <StoreItemCategory, StoreItemCategoryObject>(m); if (storeItemCategoryObject != null && storeItemCategoryObject.StoreItemCategoryId > 0) { if (storeItemCategoryObject.ParentCategoryId > 0) { var parentCategory = new StoreItemCategory(); parentCategory = storeItemCategoryEntityList.Find(x => x.StoreItemCategoryId == storeItemCategoryObject.ParentCategoryId); if (parentCategory != null && parentCategory.StoreItemCategoryId > 0) { storeItemCategoryObject.ParentName = parentCategory.Name; } else { parentCategory = _repository.GetById(storeItemCategoryObject.ParentCategoryId); if (parentCategory != null && parentCategory.StoreItemCategoryId > 0) { storeItemCategoryObject.ParentName = parentCategory.Name; } } } else { storeItemCategoryObject.ParentName = " "; } storeItemCategoryObjList.Add(storeItemCategoryObject); } }); return(storeItemCategoryObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <StoreItemCategoryObject>()); } }
public UserProfileObject GetUserProfile(long personId) { try { var myItems = _repository.GetAll(m => m.Id == personId, "Salutation").ToList(); if (!myItems.Any()) { return(new UserProfileObject()); } var myItem = myItems[0]; var personObject = ModelCrossMapper.Map <UserProfile, UserProfileObject>(myItem); if (personObject == null || personObject.Id < 1) { return(new UserProfileObject()); } if (personObject.Birthday != null) { personObject.BirthdayStr = ((DateTime)personObject.Birthday).ToString("dd/MM/yyyy"); } //personObject.Salutation = myItem.Salutation.Name; return(personObject); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new UserProfileObject()); } }
public List <StockUploadObject> GetStockUploadsByStockItem(long storeItemStockId) { try { var stockUploadEntityList = _repository.GetAll(m => m.StoreItemStockId == storeItemStockId, "ImageView").ToList(); if (!stockUploadEntityList.Any()) { return(new List <StockUploadObject>()); } var stockUploadObjList = new List <StockUploadObject>(); stockUploadEntityList.ForEach(m => { var stockUploadObject = ModelCrossMapper.Map <StockUpload, StockUploadObject>(m); if (stockUploadObject != null && stockUploadObject.StockUploadId > 0) { stockUploadObject.ViewName = m.ImageView.Name;; stockUploadObjList.Add(stockUploadObject); } }); return(stockUploadObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <StockUploadObject>()); } }
public List <StoreContactObject> GetStoreContactObjects(int?itemsPerPage, int?pageNumber) { try { List <StoreContact> storeContactEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; storeContactEntityList = _repository.GetWithPaging(m => m.StoreContactId, tpageNumber, tsize, "PersonObject, ContactTagObject").ToList(); } else { storeContactEntityList = _repository.GetAll("PersonObject, ContactTagObject").ToList(); } if (!storeContactEntityList.Any()) { return(new List <StoreContactObject>()); } var storeContactObjList = new List <StoreContactObject>(); storeContactEntityList.ForEach(m => { var storeContactObject = ModelCrossMapper.Map <StoreContact, StoreContactObject>(m); if (storeContactObject != null && storeContactObject.StoreContactId > 0) { var personObj = ModelCrossMapper.Map <Person, PersonObject>(m.Person); var contactObj = ModelCrossMapper.Map <ContactTag, ContactTagObject>(m.ContactTag); if (personObj != null && personObj.PersonId > 0 && contactObj != null && contactObj.ContactTagId > 0) { storeContactObject.PersonObject = new PersonObject(); storeContactObject.PersonObject = personObj; storeContactObject.ContactTagObject = new ContactTagObject(); storeContactObject.ContactTagObject = contactObj; storeContactObjList.Add(storeContactObject); } else { storeContactObjList.Add(storeContactObject); } } }); return(storeContactObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <StoreContactObject>()); } }
public List <CustomerObject> GetCustomerObjects(int?itemsPerPage, int?pageNumber) { try { List <Customer> customerEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; customerEntityList = _repository.GetWithPaging(m => m.UserProfile.LastName, tpageNumber, tsize, "UserProfile, StoreCustomerType, StoreOutlet").ToList(); } else { customerEntityList = _repository.GetAll("UserProfile, StoreCustomerType, StoreOutlet").ToList(); } if (!customerEntityList.Any()) { return(new List <CustomerObject>()); } var customerObjList = new List <CustomerObject>(); customerEntityList.ForEach(m => { var customerObject = ModelCrossMapper.Map <Customer, CustomerObject>(m); if (customerObject != null && customerObject.CustomerId > 0) { customerObject.UserProfileName = m.UserProfile.LastName + " " + m.UserProfile.OtherNames; customerObject.CustomerTypeName = m.StoreCustomerType.Name; customerObject.Email = m.UserProfile.ContactEmail; customerObject.MobileNumber = m.UserProfile.MobileNumber; customerObject.OfficeLine = m.UserProfile.OfficeLine; customerObject.Gender = m.UserProfile.Gender; customerObject.StoreOutletName = m.StoreOutlet.OutletName; customerObject.BirthDayStr = m.UserProfile.Birthday != null ? ((DateTime)m.UserProfile.Birthday).ToString("dd/MM/yyyy") : ""; customerObjList.Add(customerObject); } }); if (!customerObjList.Any()) { return(new List <CustomerObject>()); } return(customerObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <CustomerObject>()); } }
public List <ChildMenuObject> GetChildMenuList() { try { var childMenuEntityList = _repository.GetAll().ToList(); if (!childMenuEntityList.Any()) { return(new List <ChildMenuObject>()); } var childMenuObjList = new List <ChildMenuObject>(); childMenuEntityList.ForEach(m => { var childMenuObject = ModelCrossMapper.Map <ChildMenu, ChildMenuObject>(m); if (childMenuObject != null && childMenuObject.ChildMenuId > 0) { childMenuObjList.Add(childMenuObject); } }); return(childMenuObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(null); } }
public List <StoreItemSoldObject> GetStoreItemSolds() { try { var itemSoldEntityList = _repository.GetAll().ToList(); if (!itemSoldEntityList.Any()) { return(new List <StoreItemSoldObject>()); } var itemSoldObjList = new List <StoreItemSoldObject>(); itemSoldEntityList.ForEach(m => { var itemSoldObject = ModelCrossMapper.Map <StoreItemSold, StoreItemSoldObject>(m); if (itemSoldObject != null && itemSoldObject.StoreItemSoldId > 0) { itemSoldObjList.Add(itemSoldObject); } }); return(itemSoldObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(null); } }
public List <EmployeeObject> GetEmployees() { try { var employeeEntityList = _repository.GetAll("UserProfile").ToList(); if (!employeeEntityList.Any()) { return(new List <EmployeeObject>()); } var employeeObjList = new List <EmployeeObject>(); employeeEntityList.ForEach(m => { var employeeObject = ModelCrossMapper.Map <Employee, EmployeeObject>(m); if (employeeObject != null && employeeObject.EmployeeId > 0) { employeeObject.Name = m.UserProfile.LastName + " " + m.UserProfile.OtherNames; employeeObjList.Add(employeeObject); } }); return(employeeObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(null); } }
public List <SaleObject> GetSales() { try { var saleEntityList = _repository.GetAll().ToList(); if (!saleEntityList.Any()) { return(new List <SaleObject>()); } var saleObjList = new List <SaleObject>(); saleEntityList.ForEach(m => { var saleObject = ModelCrossMapper.Map <Sale, SaleObject>(m); if (saleObject != null && saleObject.SaleId > 0) { saleObjList.Add(saleObject); } }); return(saleObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(null); } }
public List <PackagePricingObject> GetPackagePricingObjects(int?itemsPerPage, int?pageNumber) { try { List <PackagePricing> packagePricingEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; packagePricingEntityList = _repository.GetWithPaging(m => m.PackagePricingId, tpageNumber, tsize, "BillingCycle, SubscriptionPackage").ToList(); } else { packagePricingEntityList = _repository.GetAll("BillingCycle, SubscriptionPackage").ToList(); } if (!packagePricingEntityList.Any()) { return(new List <PackagePricingObject>()); } var packagePricingObjList = new List <PackagePricingObject>(); packagePricingEntityList.ForEach(m => { var packagePricingObject = ModelCrossMapper.Map <PackagePricing, PackagePricingObject>(m); if (packagePricingObject != null && packagePricingObject.BillingCycleId > 0) { packagePricingObject.SubscriptionPackageTitle = m.SubscriptionPackage.PackageTitle; packagePricingObject.BillingCycleName = m.BillingCycle.Name; packagePricingObjList.Add(packagePricingObject); } }); return(packagePricingObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <PackagePricingObject>()); } }
public List <BankAccountObject> GetBankAccountObjects(int?itemsPerPage, int?pageNumber) { try { List <BankAccount> bankAccountEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; bankAccountEntityList = _repository.GetWithPaging(m => m.BankAccountId, tpageNumber, tsize, "StoreBank").ToList(); } else { bankAccountEntityList = _repository.GetAll("StoreBank").ToList(); } if (!bankAccountEntityList.Any()) { return(new List <BankAccountObject>()); } var bankAccountObjList = new List <BankAccountObject>(); bankAccountEntityList.ForEach(m => { var bankAccountObject = ModelCrossMapper.Map <BankAccount, BankAccountObject>(m); if (bankAccountObject != null && bankAccountObject.BankAccountId > 0) { bankAccountObject.BankName = m.StoreBank.FullName; bankAccountObjList.Add(bankAccountObject); } }); return(bankAccountObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <BankAccountObject>()); } }
public List <StoreTransactionObject> GetStoreTransactionObjects(int?itemsPerPage, int?pageNumber) { try { List <StoreTransaction> transactionEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; transactionEntityList = _repository.GetWithPaging(m => m.StoreTransactionId, tpageNumber, tsize, "StoreStorePaymentMethod, StoreTransactionType").ToList(); } else { transactionEntityList = _repository.GetAll("StoreStorePaymentMethod, StoreTransactionType").ToList(); } if (!transactionEntityList.Any()) { return(new List <StoreTransactionObject>()); } var transactionObjList = new List <StoreTransactionObject>(); transactionEntityList.ForEach(m => { var transactionObject = ModelCrossMapper.Map <StoreTransaction, StoreTransactionObject>(m); if (transactionObject != null && transactionObject.StoreTransactionId > 0) { transactionObject.StoreTransactionTypeName = m.StoreTransactionType.Name; transactionObject.PaymentMethodName = m.StorePaymentMethod.Name; transactionObjList.Add(transactionObject); } }); return(transactionObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <StoreTransactionObject>()); } }
public List <StoreSubscriptionHistoryObject> GetStoreSubscriptionHistoryObjects(int?itemsPerPage, int?pageNumber) { try { List <StoreSubscriptionHistory> storeSubscriptionEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; storeSubscriptionEntityList = _repository.GetWithPaging(m => m.StoreSubscriptionHistoryId, tpageNumber, tsize, "Store, SubscriptionPackage").ToList(); } else { storeSubscriptionEntityList = _repository.GetAll("Store, SubscriptionPackage").ToList(); } if (!storeSubscriptionEntityList.Any()) { return(new List <StoreSubscriptionHistoryObject>()); } var storeSubscriptionObjList = new List <StoreSubscriptionHistoryObject>(); storeSubscriptionEntityList.ForEach(m => { var storeSubscriptionObject = ModelCrossMapper.Map <StoreSubscriptionHistory, StoreSubscriptionHistoryObject>(m); if (storeSubscriptionObject != null && storeSubscriptionObject.StoreSubscriptionHistoryId > 0) { storeSubscriptionObject.StoreName = m.Store.StoreName; storeSubscriptionObject.PackageTitle = m.SubscriptionPackage.PackageTitle; storeSubscriptionObjList.Add(storeSubscriptionObject); } }); return(storeSubscriptionObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <StoreSubscriptionHistoryObject>()); } }
public long AddSubscriptionSetting(SubscriptionSettingObject store) { try { if (store == null) { return(-2); } var settings = _repository.GetAll().ToList(); if (settings.Any()) { var setting = settings[0]; setting.StoreId = store.StoreId; setting.SecreteKey = store.SecreteKey; setting.DatabaseSpace = store.DatabaseSpace; setting.FileStorageSpace = store.FileStorageSpace; setting.Url = store.Url; setting.DateSubscribed = store.DateSubscribed; setting.ExpiryDate = store.ExpiryDate; setting.SubscriptionStatus = store.SubscriptionStatus; _repository.Update(setting); _uoWork.SaveChanges(); return(setting.StoreId); } var storeEntity = ModelCrossMapper.Map <SubscriptionSettingObject, SubscriptionSetting>(store); if (storeEntity == null || store.StoreId < 1) { return(-2); } var returnStatus = _repository.Add(storeEntity); _uoWork.SaveChanges(); return(returnStatus.StoreId); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(0); } }
public List <CityObject> GetCityObjects(int?itemsPerPage, int?pageNumber) { try { List <City> cityEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; cityEntityList = _repository.GetWithPaging(m => m.CityId, tpageNumber, tsize, "State").ToList(); } else { cityEntityList = _repository.GetAll("State").ToList(); } if (!cityEntityList.Any()) { return(new List <CityObject>()); } var cityObjList = new List <CityObject>(); cityEntityList.ForEach(m => { var cityObject = ModelCrossMapper.Map <City, CityObject>(m); if (cityObject != null && cityObject.CityId > 0) { cityObject.StateName = m.State.Name; cityObjList.Add(cityObject); } }); return(cityObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <CityObject>()); } }
public List<RegisterObject> GetRegisterObjects(int? itemsPerPage, int? pageNumber) { try { List<Register> registerEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; registerEntityList = _repository.GetWithPaging(m => m.RegisterId, tpageNumber, tsize, "StoreOutlet").ToList(); } else { registerEntityList = _repository.GetAll("StoreOutlet").ToList(); } if (!registerEntityList.Any()) { return new List<RegisterObject>(); } var registerObjList = new List<RegisterObject>(); registerEntityList.ForEach(m => { var registerObject = ModelCrossMapper.Map<Register, RegisterObject>(m); if (registerObject != null && registerObject.RegisterId > 0) { registerObject.OutletName = m.StoreOutlet.OutletName; registerObjList.Add(registerObject); } }); return registerObjList; } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return new List<RegisterObject>(); } }
public List <CouponObject> GetCouponObjects(int?itemsPerPage, int?pageNumber) { try { List <Coupon> couponEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; couponEntityList = _repository.GetWithPaging(m => m.CouponId, tpageNumber, tsize).ToList(); } else { couponEntityList = _repository.GetAll().ToList(); } if (!couponEntityList.Any()) { return(new List <CouponObject>()); } var couponObjList = new List <CouponObject>(); couponEntityList.ForEach(m => { var couponObject = ModelCrossMapper.Map <Coupon, CouponObject>(m); if (couponObject != null && couponObject.CouponId > 0) { couponObject.ValidityPeriod = couponObject.ValidFrom.ToString("dd/MM/yyyy") + " - " + couponObject.ValidTo.ToString("dd/MM/yyyy"); couponObjList.Add(couponObject); } }); return(couponObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <CouponObject>()); } }
public List <UnitsOfMeasurementObject> GetUnitsOfMeasurementObject(int?itemsPerPage, int?pageNumber) { try { List <UnitsOfMeasurement> unitsOfMeasurementEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; unitsOfMeasurementEntityList = _repository.GetWithPaging(m => m.UnitOfMeasurementId, tpageNumber, tsize).ToList(); } else { unitsOfMeasurementEntityList = _repository.GetAll().ToList(); } if (!unitsOfMeasurementEntityList.Any()) { return(new List <UnitsOfMeasurementObject>()); } var unitsOfMeasurementObjList = new List <UnitsOfMeasurementObject>(); unitsOfMeasurementEntityList.ForEach(m => { var unitsOfMeasurementObject = ModelCrossMapper.Map <UnitsOfMeasurement, UnitsOfMeasurementObject>(m); if (unitsOfMeasurementObject != null && unitsOfMeasurementObject.UnitOfMeasurementId > 0) { unitsOfMeasurementObjList.Add(unitsOfMeasurementObject); } }); return(unitsOfMeasurementObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <UnitsOfMeasurementObject>()); } }
public List <DeliveryMethodObject> GetDeliveryMethodObjects(int?itemsPerPage, int?pageNumber) { try { List <DeliveryMethod> deliveryMethodEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; deliveryMethodEntityList = _repository.GetWithPaging(m => m.DeliveryMethodId, tpageNumber, tsize).ToList(); } else { deliveryMethodEntityList = _repository.GetAll().ToList(); } if (!deliveryMethodEntityList.Any()) { return(new List <DeliveryMethodObject>()); } var deliveryMethodObjList = new List <DeliveryMethodObject>(); deliveryMethodEntityList.ForEach(m => { var deliveryMethodObject = ModelCrossMapper.Map <DeliveryMethod, DeliveryMethodObject>(m); if (deliveryMethodObject != null && deliveryMethodObject.DeliveryMethodId > 0) { deliveryMethodObjList.Add(deliveryMethodObject); } }); return(deliveryMethodObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <DeliveryMethodObject>()); } }
public StoreCurrencyObject GetStoreCurrency() { try { var myItems = _repository.GetAll().ToList(); if (!myItems.Any()) { return(new StoreCurrencyObject()); } var currencyObject = ModelCrossMapper.Map <StoreCurrency, StoreCurrencyObject>(myItems[0]); if (currencyObject == null || currencyObject.StoreCurrencyId < 1) { return(new StoreCurrencyObject()); } return(currencyObject); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new StoreCurrencyObject()); } }
public List <ImageViewObject> GetImageViewObjects(int?itemsPerPage, int?pageNumber) { try { List <ImageView> imageViewEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; imageViewEntityList = _repository.GetWithPaging(m => m.ImageViewId, tpageNumber, tsize).ToList(); } else { imageViewEntityList = _repository.GetAll().ToList(); } if (!imageViewEntityList.Any()) { return(new List <ImageViewObject>()); } var imageViewObjList = new List <ImageViewObject>(); imageViewEntityList.ForEach(m => { var imageViewObject = ModelCrossMapper.Map <ImageView, ImageViewObject>(m); if (imageViewObject != null && imageViewObject.ImageViewId > 0) { imageViewObjList.Add(imageViewObject); } }); return(imageViewObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <ImageViewObject>()); } }
public List <BillingCycleObject> GetBillingCycleObjects(int?itemsPerPage, int?pageNumber) { try { List <BillingCycle> billingCycleEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; billingCycleEntityList = _repository.GetWithPaging(m => m.BillingCycleId, tpageNumber, tsize).ToList(); } else { billingCycleEntityList = _repository.GetAll().ToList(); } if (!billingCycleEntityList.Any()) { return(new List <BillingCycleObject>()); } var billingCycleObjList = new List <BillingCycleObject>(); billingCycleEntityList.ForEach(m => { var billingCycleObject = ModelCrossMapper.Map <BillingCycle, BillingCycleObject>(m); if (billingCycleObject != null && billingCycleObject.BillingCycleId > 0) { billingCycleObjList.Add(billingCycleObject); } }); return(billingCycleObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <BillingCycleObject>()); } }
public List <StoreContactTagObject> GetContactTagObjects(int?itemsPerPage, int?pageNumber) { try { List <StoreContactTag> contactTagEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; contactTagEntityList = _repository.GetWithPaging(m => m.ContactTagId, tpageNumber, tsize).ToList(); } else { contactTagEntityList = _repository.GetAll().ToList(); } if (!contactTagEntityList.Any()) { return(new List <StoreContactTagObject>()); } var contactTagObjList = new List <StoreContactTagObject>(); contactTagEntityList.ForEach(m => { var contactTagObject = ModelCrossMapper.Map <StoreContactTag, StoreContactTagObject>(m); if (contactTagObject != null && contactTagObject.ContactTagId > 0) { contactTagObjList.Add(contactTagObject); } }); return(contactTagObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <StoreContactTagObject>()); } }
public List<SaleTransactionObject> GetSaleTransactionObjects(int? itemsPerPage, int? pageNumber) { try { List<SaleTransaction> saleTransactionEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; saleTransactionEntityList = _repository.GetWithPaging(m => m.SaleTransactionId, tpageNumber, tsize).ToList(); } else { saleTransactionEntityList = _repository.GetAll().ToList(); } if (!saleTransactionEntityList.Any()) { return new List<SaleTransactionObject>(); } var saleTransactionObjList = new List<SaleTransactionObject>(); saleTransactionEntityList.ForEach(m => { var saleTransactionObject = ModelCrossMapper.Map<SaleTransaction, SaleTransactionObject>(m); if (saleTransactionObject != null && saleTransactionObject.SaleTransactionId > 0) { saleTransactionObjList.Add(saleTransactionObject); } }); return saleTransactionObjList; } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return new List<SaleTransactionObject>(); } }
public List <ShoppingCartObject> GetShoppingCartObjects(int?itemsPerPage, int?pageNumber) { try { List <ShoppingCart> shoppingCartEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; shoppingCartEntityList = _repository.GetWithPaging(m => m.ShoppingCartId, tpageNumber, tsize, "Customer, ShopingCartItems").ToList(); } else { shoppingCartEntityList = _repository.GetAll().ToList(); } if (!shoppingCartEntityList.Any()) { return(new List <ShoppingCartObject>()); } var shoppingCartObjList = new List <ShoppingCartObject>(); shoppingCartEntityList.ForEach(m => { var shoppingCartObject = ModelCrossMapper.Map <ShoppingCart, ShoppingCartObject>(m); if (shoppingCartObject != null && shoppingCartObject.ShoppingCartId > 0) { shoppingCartObjList.Add(shoppingCartObject); } }); return(shoppingCartObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <ShoppingCartObject>()); } }
public List <AccountGroupObject> GetAccountGroupObject(int?itemsPerPage, int?pageNumber) { try { List <AccountGroup> accountGroupEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; accountGroupEntityList = _repository.GetWithPaging(m => m.AccountGroupId, tpageNumber, tsize).ToList(); } else { accountGroupEntityList = _repository.GetAll().ToList(); } if (!accountGroupEntityList.Any()) { return(new List <AccountGroupObject>()); } var accountGroupObjList = new List <AccountGroupObject>(); accountGroupEntityList.ForEach(m => { var accountGroupObject = ModelCrossMapper.Map <AccountGroup, AccountGroupObject>(m); if (accountGroupObject != null && accountGroupObject.AccountGroupId > 0) { accountGroupObjList.Add(accountGroupObject); } }); return(accountGroupObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <AccountGroupObject>()); } }
public List <PaymentTypeObject> GetPaymentTypeObjects(int?itemsPerPage, int?pageNumber) { try { List <PaymentType> paymentTypeEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; paymentTypeEntityList = _repository.GetWithPaging(m => m.PaymentTypeId, tpageNumber, tsize).ToList(); } else { paymentTypeEntityList = _repository.GetAll().ToList(); } if (!paymentTypeEntityList.Any()) { return(new List <PaymentTypeObject>()); } var paymentTypeObjList = new List <PaymentTypeObject>(); paymentTypeEntityList.ForEach(m => { var paymentTypeObject = ModelCrossMapper.Map <PaymentType, PaymentTypeObject>(m); if (paymentTypeObject != null && paymentTypeObject.PaymentTypeId > 0) { paymentTypeObjList.Add(paymentTypeObject); } }); return(paymentTypeObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <PaymentTypeObject>()); } }
public List <StoreItemStockObject> GetInventoryObjects(int outletId) { try { var storeItemStockEntityList = _repository.GetAll(m => m.StoreOutletId == outletId, "StoreItem, StoreItemVariationValue, StoreItemVariation").ToList(); if (!storeItemStockEntityList.Any()) { return(new List <StoreItemStockObject>()); } var storeItemStockObjList = new List <StoreItemStockObject>(); storeItemStockEntityList.ForEach(m => { var storeItemStockObject = ModelCrossMapper.Map <StoreItemStock, StoreItemStockObject>(m); if (storeItemStockObject != null && storeItemStockObject.StoreItemStockId > 0) { if (m.StoreItemVariationId > 0) { storeItemStockObject.StoreItemName = m.StoreItem.Name + "/" + m.StoreItemVariationValue.Value; } if (storeItemStockObject.ExpirationDate != null) { storeItemStockObject.ExpiryDate = ((DateTime)storeItemStockObject.ExpirationDate).ToString("yyyy/MM/dd"); } storeItemStockObjList.Add(storeItemStockObject); } }); return(storeItemStockObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <StoreItemStockObject>()); } }
public long AddStoreAddress(StoreAddressObject city) { try { if (city == null) { return(-2); } var duplicates = _repository.Count(m => m.StreetNo.Trim().ToLower().Equals(city.StreetNo.Trim().ToLower()) && city.StoreCityId.Equals(m.StoreCityId)); if (duplicates > 0) { var ads = _repository.GetAll(m => m.StreetNo.Trim().ToLower().Equals(city.StreetNo.Trim().ToLower()) && city.StoreCityId.Equals(m.StoreCityId)).ToList(); if (ads.Any()) { return(ads[0].StoreAddressId); } } var cityEntity = ModelCrossMapper.Map <StoreAddressObject, StoreAddress>(city); if (cityEntity == null || string.IsNullOrEmpty(cityEntity.StreetNo)) { return(-2); } var returnStatus = _repository.Add(cityEntity); _uoWork.SaveChanges(); return(returnStatus.StoreAddressId); } catch (DbEntityValidationException e) { var str = ""; foreach (var eve in e.EntityValidationErrors) { str += string.Format("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State) + "\n"; foreach (var ve in eve.ValidationErrors) { str += string.Format("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage) + " \n"; } } ErrorLogger.LogError(e.StackTrace, e.Source, str); return(0); } }
public List <SupplierObject> GetSupplierObjects(int?itemsPerPage, int?pageNumber) { try { List <Supplier> supplierEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; supplierEntityList = _repository.GetWithPaging(m => m.SupplierId, tpageNumber, tsize, "SupplierAddresses, PurchaseOrders").ToList(); } else { supplierEntityList = _repository.GetAll("SupplierAddresses, PurchaseOrders").ToList(); } if (!supplierEntityList.Any()) { return(new List <SupplierObject>()); } var supplierObjList = new List <SupplierObject>(); supplierEntityList.ForEach(m => { var supplierObject = ModelCrossMapper.Map <Supplier, SupplierObject>(m); if (supplierObject != null && supplierObject.SupplierId > 0) { supplierObject.SupplierAddressObjects = new List <SupplierAddressObject>(); supplierObject.PurchaseOrderObjects = new List <PurchaseOrderObject>(); if (m.SupplierAddresses.Any()) { var addressList = m.SupplierAddresses.ToList(); addressList.ForEach(x => { var address = ModelCrossMapper.Map <SupplierAddress, SupplierAddressObject>(x); if (address != null && address.AddressId > 0) { supplierObject.SupplierAddressObjects.Add(address); } }); } if (m.PurchaseOrders.Any()) { var purchaseList = m.PurchaseOrders.ToList(); purchaseList.ForEach(x => { var purchaseOrder = ModelCrossMapper.Map <PurchaseOrder, PurchaseOrderObject>(x); if (purchaseOrder != null && purchaseOrder.PurchaseOrderId > 0) { supplierObject.PurchaseOrderObjects.Add(purchaseOrder); } }); } supplierObject.DateRegistered = supplierObject.DateJoined.ToString("dd/MM/yyyy"); supplierObjList.Add(supplierObject); } }); return(supplierObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <SupplierObject>()); } }