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 <StoreItemStockObject> GetStoreItemStocksByStoreItem(int?itemsPerPage, int?pageNumber, int storeItemId) { try { List <StoreItemStock> storeItemStockEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; storeItemStockEntityList = _repository.GetWithPaging(m => m.StoreItemId == storeItemId, m => m.StoreItemId, tpageNumber, tsize, "StoreCurrency, StoreItem, StoreOutlet, StoreItemVariationValue, StoreItemVariation").ToList(); } else { storeItemStockEntityList = _repository.GetAll(m => m.StoreItemId == storeItemId, "StoreCurrency, StoreItem, StoreOutlet, 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 != null && m.StoreItemVariationId > 0) { storeItemStockObject.VariationProperty = m.StoreItemVariation.VariationProperty; storeItemStockObject.VariationValue = m.StoreItemVariationValue.Value; } storeItemStockObject.StoreItemName = m.StoreItem.Name; storeItemStockObject.StoreOutletName = m.StoreOutlet.OutletName; storeItemStockObject.CurrencyName = m.StoreCurrency.Name; storeItemStockObject.CurrencySymbol = m.StoreCurrency.Symbol; if (storeItemStockObject.ExpirationDate != null) { storeItemStockObject.ExpiryDate = ((DateTime)storeItemStockObject.ExpirationDate).ToString("dd/MM/yyyy"); } storeItemStockObjList.Add(storeItemStockObject); } }); return(storeItemStockObjList.OrderBy(h => h.StoreItemName).ToList()); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <StoreItemStockObject>()); } }
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 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 <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 <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 <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 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 <TransactionTypeObject> GetTransactionTypeObjects(int?itemsPerPage, int?pageNumber) { try { List <TransactionType> transactionTypeEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; transactionTypeEntityList = _repository.GetWithPaging(m => m.TransactionTypeId, tpageNumber, tsize).ToList(); } else { transactionTypeEntityList = _repository.GetAll().ToList(); } if (!transactionTypeEntityList.Any()) { return(new List <TransactionTypeObject>()); } var transactionTypeObjList = new List <TransactionTypeObject>(); transactionTypeEntityList.ForEach(m => { var transactionTypeObject = ModelCrossMapper.Map <TransactionType, TransactionTypeObject>(m); if (transactionTypeObject != null && transactionTypeObject.TransactionTypeId > 0) { transactionTypeObjList.Add(transactionTypeObject); } }); return(transactionTypeObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <TransactionTypeObject>()); } }
public List <UserProfileObject> GetUserProfileObjects(int?itemsPerPage, int?pageNumber) { try { List <UserProfile> personEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; personEntityList = _repository.GetWithPaging(m => m.Id, tpageNumber, tsize, "Salutation").ToList(); } else { personEntityList = _repository.GetAll("Salutation").ToList(); } if (!personEntityList.Any()) { return(new List <UserProfileObject>()); } var personObjList = new List <UserProfileObject>(); personEntityList.ForEach(m => { var personObject = ModelCrossMapper.Map <UserProfile, UserProfileObject>(m); if (personObject != null && personObject.Id > 0) { if (personObject.Birthday != null) { //personObject.Salutation = m.Salutation.Name; personObject.BirthdayStr = ((DateTime)personObject.Birthday).ToString("dd/MM/yyyy"); } personObjList.Add(personObject); } }); return(personObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <UserProfileObject>()); } }
public List <ChartOfAccountObject> GetChartOfAccountObjects(int?itemsPerPage, int?pageNumber) { try { List <ChartOfAccount> chartOfAccountEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; chartOfAccountEntityList = _repository.GetWithPaging(m => m.ChartOfAccountId, tpageNumber, tsize, "AccountGroup").ToList(); } else { chartOfAccountEntityList = _repository.GetAll("AccountGroup").ToList(); } if (!chartOfAccountEntityList.Any()) { return(new List <ChartOfAccountObject>()); } var chartOfAccountObjList = new List <ChartOfAccountObject>(); chartOfAccountEntityList.ForEach(m => { var chartOfAccountObject = ModelCrossMapper.Map <ChartOfAccount, ChartOfAccountObject>(m); if (chartOfAccountObject != null && chartOfAccountObject.ChartOfAccountId > 0) { chartOfAccountObject.AccountGroupName = m.AccountGroup.Name; chartOfAccountObjList.Add(chartOfAccountObject); } }); return(chartOfAccountObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <ChartOfAccountObject>()); } }
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 <StoreCurrencyObject> GetStoreCurrencyObjects(int?itemsPerPage, int?pageNumber) { try { List <StoreCurrency> currencyEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; currencyEntityList = _repository.GetWithPaging(m => m.StoreCurrencyId, tpageNumber, tsize, "StoreCountry").ToList(); } else { currencyEntityList = _repository.GetAll("StoreCountry").ToList(); } if (!currencyEntityList.Any()) { return(new List <StoreCurrencyObject>()); } var currencyObjList = new List <StoreCurrencyObject>(); currencyEntityList.ForEach(m => { var currencyObject = ModelCrossMapper.Map <StoreCurrency, StoreCurrencyObject>(m); if (currencyObject != null && currencyObject.StoreCurrencyId > 0) { currencyObject.CountryName = m.StoreCountry.Name; currencyObjList.Add(currencyObject); } }); return(currencyObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <StoreCurrencyObject>()); } }
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 <PaymentGatewayObject> GetPaymentGatewayObjects(int?itemsPerPage, int?pageNumber) { try { List <PaymentGateway> paymentGatewayEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; paymentGatewayEntityList = _repository.GetWithPaging(m => m.PaymentGatewayId, tpageNumber, tsize).ToList(); } else { paymentGatewayEntityList = _repository.GetAll().ToList(); } if (!paymentGatewayEntityList.Any()) { return(new List <PaymentGatewayObject>()); } var paymentGatewayObjList = new List <PaymentGatewayObject>(); paymentGatewayEntityList.ForEach(m => { var paymentGatewayObject = ModelCrossMapper.Map <PaymentGateway, PaymentGatewayObject>(m); if (paymentGatewayObject != null && paymentGatewayObject.PaymentGatewayId > 0) { paymentGatewayObjList.Add(paymentGatewayObject); } }); return(paymentGatewayObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <PaymentGatewayObject>()); } }
public List <StoreItemVariationValueObject> GetStoreItemVariationValueObjects(int?itemsPerPage, int?pageNumber) { try { List <StoreItemVariationValue> productVariationValueEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; productVariationValueEntityList = _repository.GetWithPaging(m => m.StoreItemVariationValueId, tpageNumber, tsize).ToList(); } else { productVariationValueEntityList = _repository.GetAll().ToList(); } if (!productVariationValueEntityList.Any()) { return(new List <StoreItemVariationValueObject>()); } var productVariationValueObjList = new List <StoreItemVariationValueObject>(); productVariationValueEntityList.ForEach(m => { var productVariationValueObject = ModelCrossMapper.Map <StoreItemVariationValue, StoreItemVariationValueObject>(m); if (productVariationValueObject != null && productVariationValueObject.StoreItemVariationValueId > 0) { productVariationValueObjList.Add(productVariationValueObject); } }); return(productVariationValueObjList); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new List <StoreItemVariationValueObject>()); } }
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 <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 <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 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 <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 <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 <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>()); } }
public List <ActiveSubscriptionObject> GetActiveSubscriptionObjects(int?itemsPerPage, int?pageNumber) { try { List <activeSubscription> activeSubscriptionEntityList; if ((itemsPerPage != null && itemsPerPage > 0) && (pageNumber != null && pageNumber >= 0)) { var tpageNumber = (int)pageNumber; var tsize = (int)itemsPerPage; activeSubscriptionEntityList = _repository.GetWithPaging(m => m.activeSubscriptionId, tpageNumber, tsize, "ChartOfAccount, activeSubscriptionBrand, activeSubscriptionCategory, activeSubscriptionType").ToList(); } else { activeSubscriptionEntityList = _repository.GetAll("ChartOfAccount, activeSubscriptionBrand, activeSubscriptionCategory, activeSubscriptionType").ToList(); } if (!activeSubscriptionEntityList.Any()) { return(new List <ActiveSubscriptionObject>()); } var activeSubscriptionObjList = new List <ActiveSubscriptionObject>(); activeSubscriptionEntityList.ForEach(m => { var ActiveSubscriptionObject = ModelCrossMapper.Map <activeSubscription, ActiveSubscriptionObject>(m); if (ActiveSubscriptionObject != null && ActiveSubscriptionObject.activeSubscriptionId > 0) { ActiveSubscriptionObject.ChartOfAccountTypeName = m.ChartOfAccount.AccountType; ActiveSubscriptionObject.activeSubscriptionCategoryName = m.activeSubscriptionCategory.Name; ActiveSubscriptionObject.activeSubscriptionTypeName = m.activeSubscriptionType.Name; ActiveSubscriptionObject.activeSubscriptionBrandName = m.activeSubscriptionBrand.Name; if (ActiveSubscriptionObject.ParentItemId > 0) { var parentItem = new activeSubscription(); parentItem = activeSubscriptionEntityList.Find(x => x.activeSubscriptionId == ActiveSubscriptionObject.ParentItemId); if (parentItem != null && parentItem.activeSubscriptionId > 0) { ActiveSubscriptionObject.ParentItemName = parentItem.Name; } else { parentItem = _repository.GetById(ActiveSubscriptionObject.ParentItemId); if (parentItem != null && parentItem.activeSubscriptionId > 0) { ActiveSubscriptionObject.ParentItemName = parentItem.Name; } } } else { ActiveSubscriptionObject.ParentItemName = " "; } activeSubscriptionObjList.Add(ActiveSubscriptionObject); } }); return(activeSubscriptionObjList); } catch (Exception ex) { ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message); return(new List <ActiveSubscriptionObject>()); } }