public StoreOutletObject GetStoreOutlet(long storeOutletId) { try { var myItem = _repository.Get(m => m.StoreOutletId == storeOutletId, "StoreAddress"); if (myItem == null || myItem.StoreOutletId < 1) { return(new StoreOutletObject()); } var storeOutletObject = ModelCrossMapper.Map <StoreOutlet, StoreOutletObject>(myItem); if (storeOutletObject == null || storeOutletObject.StoreOutletId < 1) { return(new StoreOutletObject()); } storeOutletObject.Address = myItem.StoreAddress.StreetNo; var city = new StoreCityRepository().GetStoreCity(myItem.StoreAddress.StoreCityId); if (city != null && city.StoreCityId > 0) { storeOutletObject.CityName = city.Name; storeOutletObject.StoreCityId = city.StoreCityId; } return(storeOutletObject); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new StoreOutletObject()); } }
public StoreContactObject GetStoreContact(long storeContactId) { try { var myItem = _repository.Get(m => m.StoreContactId == storeContactId, "Person, ContactTag"); if (myItem == null || myItem.StoreContactId < 1) { return(new StoreContactObject()); } var storeContactObject = ModelCrossMapper.Map <StoreContact, StoreContactObject>(myItem); if (storeContactObject == null || storeContactObject.StoreContactId < 1) { return(new StoreContactObject()); } var personObj = ModelCrossMapper.Map <Person, PersonObject>(myItem.Person); var contactObj = ModelCrossMapper.Map <ContactTag, ContactTagObject>(myItem.ContactTag); if (personObj != null && personObj.PersonId > 0 && contactObj != null && contactObj.ContactTagId > 0) { storeContactObject.PersonObject = personObj; storeContactObject.ContactTagObject = contactObj; return(storeContactObject); } return(new StoreContactObject()); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new StoreContactObject()); } }
public SubscriptionPackageObject GetSubscriptionPackage(long subscriptionPackageId) { try { var myItem = _repository.Get(m => m.SubscriptionPackageId == subscriptionPackageId, "PackagePricings"); if (myItem == null || myItem.SubscriptionPackageId < 1) { return(new SubscriptionPackageObject()); } var subscriptionPackageObject = ModelCrossMapper.Map <SubscriptionPackage, SubscriptionPackageObject>(myItem); if (subscriptionPackageObject == null || subscriptionPackageObject.SubscriptionPackageId < 1) { return(new SubscriptionPackageObject()); } if (!subscriptionPackageObject.PackagePricings.Any()) { return(new SubscriptionPackageObject()); } subscriptionPackageObject.Price = subscriptionPackageObject.PackagePricings.ToList()[0].Price; return(subscriptionPackageObject); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new SubscriptionPackageObject()); } }
public StoreSettingObject GetStoreSetting(string storeAlias) { try { var myItem = _repository.Get(m => m.StoreAlias.Trim().ToLower() == storeAlias, "StoreSetting"); if (myItem == null || myItem.StoreId < 1) { return(new StoreSettingObject()); } if (myItem.StoreSetting == null || myItem.StoreSetting.StoreId < 1) { return(new StoreSettingObject()); } var storeSettingObject = ModelCrossMapper.Map <StoreSetting, StoreSettingObject>(myItem.StoreSetting); if (storeSettingObject == null || storeSettingObject.StoreId < 1) { return(new StoreSettingObject()); } return(storeSettingObject); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new StoreSettingObject()); } }
public SupplierObject GetSupplier(long supplierId) { try { var myItem = _repository.Get(m => m.SupplierId == supplierId, "SupplierAddresses, PurchaseOrders"); if (myItem == null || myItem.SupplierId < 1) { return(new SupplierObject()); } var supplierObject = ModelCrossMapper.Map <Supplier, SupplierObject>(myItem); if (supplierObject == null || supplierObject.SupplierId < 1) { return(new SupplierObject()); } supplierObject.SupplierAddressObjects = new List <SupplierAddressObject>(); supplierObject.PurchaseOrderObjects = new List <PurchaseOrderObject>(); if (myItem.SupplierAddresses.Any()) { var addressList = myItem.SupplierAddresses.ToList(); addressList.ForEach(m => { var address = ModelCrossMapper.Map <SupplierAddress, SupplierAddressObject>(m); if (address != null && address.AddressId > 0) { supplierObject.SupplierAddressObjects.Add(address); } }); } if (myItem.PurchaseOrders.Any()) { var purchaseList = myItem.PurchaseOrders.ToList(); purchaseList.ForEach(m => { var purchaseOrder = ModelCrossMapper.Map <PurchaseOrder, PurchaseOrderObject>(m); if (purchaseOrder != null && purchaseOrder.PurchaseOrderId > 0) { supplierObject.PurchaseOrderObjects.Add(purchaseOrder); } }); } return(supplierObject); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new SupplierObject()); } }
public BankAccountObject GetBankAccount(long bankAccountId) { try { var myItem = _repository.Get(m => m.BankAccountId == bankAccountId, "StoreBank"); if (myItem == null || myItem.BankAccountId < 1) { return(new BankAccountObject()); } var bankAccountObject = ModelCrossMapper.Map <BankAccount, BankAccountObject>(myItem); if (bankAccountObject == null || bankAccountObject.BankAccountId < 1) { return(new BankAccountObject()); } bankAccountObject.BankName = myItem.StoreBank.FullName; return(bankAccountObject); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new BankAccountObject()); } }
public PackagePricingObject GetPackagePricing(long packagePricingId) { try { var myItem = _repository.Get(m => m.PackagePricingId == packagePricingId, "BillingCycle, SubscriptionPackage"); if (myItem == null || myItem.BillingCycleId < 1) { return(new PackagePricingObject()); } var packagePricingObject = ModelCrossMapper.Map <PackagePricing, PackagePricingObject>(myItem); if (packagePricingObject == null || packagePricingObject.SubscriptionPackageId < 1) { return(new PackagePricingObject()); } packagePricingObject.SubscriptionPackageTitle = myItem.SubscriptionPackage.PackageTitle; packagePricingObject.BillingCycleName = myItem.BillingCycle.Name; return(packagePricingObject); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new PackagePricingObject()); } }
public StoreItemObject GetStoreItem(long storeItemId) { try { var myItem = _repository.Get(m => m.StoreItemId == storeItemId, "ChartOfAccount, StoreItemBrand, StoreItemCategory, StoreItemType"); if (myItem == null || myItem.StoreItemId < 1) { return(new StoreItemObject()); } var storeItemObject = ModelCrossMapper.Map <StoreItem, StoreItemObject>(myItem); if (storeItemObject == null || storeItemObject.StoreItemId < 1) { return(new StoreItemObject()); } storeItemObject.ChartOfAccountTypeName = myItem.ChartOfAccount.AccountType; storeItemObject.StoreItemCategoryName = myItem.StoreItemCategory.Name; storeItemObject.StoreItemTypeName = myItem.StoreItemType.Name; storeItemObject.StoreItemBrandName = myItem.StoreItemBrand.Name; if (storeItemObject.ParentItemId > 0) { var parentItem = _repository.GetById(storeItemObject.ParentItemId); if (parentItem != null && parentItem.StoreItemId > 0) { storeItemObject.ParentItemName = parentItem.Name; } } else { storeItemObject.ParentItemName = " "; } return(storeItemObject); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new StoreItemObject()); } }
public RegisterObject GetRegister(long registerId) { try { var myItem = _repository.Get(m => m.RegisterId == registerId, "StoreOutlet"); if (myItem == null || myItem.RegisterId < 1) { return new RegisterObject(); } var registerObject = ModelCrossMapper.Map<Register, RegisterObject>(myItem); if (registerObject == null || registerObject.RegisterId < 1) { return new RegisterObject(); } return registerObject; } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return new RegisterObject(); } }
public StoreSettingObject GetStoreSetting(long storeId) { try { var myItem = _repository.Get(m => m.StoreId == storeId, "Store"); if (myItem == null || myItem.StoreId < 1) { return(new StoreSettingObject()); } var storeSettingObject = ModelCrossMapper.Map <StoreSetting, StoreSettingObject>(myItem); if (storeSettingObject == null || storeSettingObject.StoreId < 1) { return(new StoreSettingObject()); } return(storeSettingObject); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new StoreSettingObject()); } }
public ShoppingCartObject GetShoppingCart(long shoppingCartId) { try { using (var db = _dbStoreEntities) { var item = from sh in db.ShoppingCarts where sh.ShoppingCartId == shoppingCartId join cs in db.Customers on sh.CustomerId equals cs.CustomerId join ps in db.UserProfiles on cs.UserId equals ps.Id join si in db.ShopingCartItems on sh.ShoppingCartId equals si.ShopingCartId join st in db.StoreItemStocks on si.ShopingCartItemId equals st.StoreItemStockId join sti in db.StoreItems on st.StoreItemId equals sti.StoreItemId join sp in db.StoreItemTypes on sti.StoreItemTypeId equals sp.StoreItemTypeId join sb in db.StoreItemBrands on sti.StoreItemBrandId equals sb.StoreItemBrandId join sc in db.StoreItemCategories on sti.StoreItemCategoryId equals sc.StoreItemCategoryId join um in db.UnitsOfMeasurements on si.UoMId equals um.UnitOfMeasurementId select new{ sh, cs, ps, si, st, sti, sp, sb, sc, um }; } var myItem = _repository.Get(m => m.ShoppingCartId == shoppingCartId, "Customer, ShopingCartItems"); if (myItem == null || myItem.ShoppingCartId < 1) { return(new ShoppingCartObject()); } var shoppingCartObject = ModelCrossMapper.Map <ShoppingCart, ShoppingCartObject>(myItem); if (shoppingCartObject == null || shoppingCartObject.ShoppingCartId < 1) { return(new ShoppingCartObject()); } return(shoppingCartObject); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new ShoppingCartObject()); } }
public StateObject GetState(long stateId) { try { var myItem = _repository.Get(m => m.StateId == stateId, "Country"); if (myItem == null || myItem.StateId < 1) { return(new StateObject()); } var stateObject = ModelCrossMapper.Map <State, StateObject>(myItem); if (stateObject == null || stateObject.StateId < 1) { return(new StateObject()); } stateObject.CountryName = myItem.Country.Name; return(stateObject); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new StateObject()); } }
public StoreSubscriptionHistoryObject GetStoreSubscriptionHistory(long storeSubscriptionId) { try { var myItem = _repository.Get(m => m.StoreSubscriptionHistoryId == storeSubscriptionId, "Store, SubscriptionPackage"); if (myItem == null || myItem.StoreSubscriptionHistoryId < 1) { return(new StoreSubscriptionHistoryObject()); } var storeSubscriptionObject = ModelCrossMapper.Map <StoreSubscriptionHistory, StoreSubscriptionHistoryObject>(myItem); if (storeSubscriptionObject == null || storeSubscriptionObject.StoreSubscriptionHistoryId < 1) { return(new StoreSubscriptionHistoryObject()); } storeSubscriptionObject.StoreName = myItem.Store.StoreName; storeSubscriptionObject.PackageTitle = myItem.SubscriptionPackage.PackageTitle; return(storeSubscriptionObject); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new StoreSubscriptionHistoryObject()); } }
public StoreTransactionObject GetStoreTransaction(long transactionId) { try { var myItem = _repository.Get(m => m.StoreTransactionId == transactionId, "StoreStorePaymentMethod, StoreTransactionType"); if (myItem == null || myItem.StoreTransactionId < 1) { return(new StoreTransactionObject()); } var transactionObject = ModelCrossMapper.Map <StoreTransaction, StoreTransactionObject>(myItem); if (transactionObject == null || transactionObject.StoreTransactionId < 1) { return(new StoreTransactionObject()); } transactionObject.StoreTransactionTypeName = myItem.StoreTransactionType.Name; transactionObject.PaymentMethodName = myItem.StorePaymentMethod.Name; return(transactionObject); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(new StoreTransactionObject()); } }