예제 #1
0
        public Int32 UpdateStore(long storeId, string logoPath)
        {
            try
            {
                if (string.IsNullOrEmpty(logoPath))
                {
                    return(-2);
                }
                var store = _repository.GetById(storeId);
                if (store == null || store.StoreId < 1)
                {
                    return(-2);
                }

                store.StoreLogoPath = logoPath;
                _repository.Update(store);
                _uoWork.SaveChanges();
                return(5);
            }
            catch (Exception ex)
            {
                ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
                return(-2);
            }
        }
예제 #2
0
        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 ActiveSubscriptionObject GetactiveSubscription(long activeSubscriptionId)
        {
            try
            {
                var myItem = _repository.GetById(m => m.activeSubscriptionId == activeSubscriptionId, "ChartOfAccount, activeSubscriptionBrand, activeSubscriptionCategory, activeSubscriptionType");
                if (myItem == null || myItem.activeSubscriptionId < 1)
                {
                    return(new ActiveSubscriptionObject());
                }
                var ActiveSubscriptionObject = ModelCrossMapper.Map <activeSubscription, ActiveSubscriptionObject>(myItem);
                if (ActiveSubscriptionObject == null || ActiveSubscriptionObject.activeSubscriptionId < 1)
                {
                    return(new ActiveSubscriptionObject());
                }
                ActiveSubscriptionObject.ChartOfAccountTypeName         = myItem.ChartOfAccount.AccountType;
                ActiveSubscriptionObject.activeSubscriptionCategoryName = myItem.activeSubscriptionCategory.Name;
                ActiveSubscriptionObject.activeSubscriptionTypeName     = myItem.activeSubscriptionType.Name;
                ActiveSubscriptionObject.activeSubscriptionBrandName    = myItem.activeSubscriptionBrand.Name;
                if (ActiveSubscriptionObject.ParentItemId > 0)
                {
                    var parentItem = _repository.GetById(ActiveSubscriptionObject.ParentItemId);

                    if (parentItem != null && parentItem.activeSubscriptionId > 0)
                    {
                        ActiveSubscriptionObject.ParentItemName = parentItem.Name;
                    }
                }
                else
                {
                    ActiveSubscriptionObject.ParentItemName = " ";
                }

                return(ActiveSubscriptionObject);
            }
            catch (Exception ex)
            {
                ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message);
                return(new ActiveSubscriptionObject());
            }
        }
예제 #4
0
 public StoreItemCategoryObject GetStoreItemCategory(long storeItemCategoryId)
 {
     try
     {
         var myItem = _repository.GetById(storeItemCategoryId);
         if (myItem == null || myItem.StoreItemCategoryId < 1)
         {
             return(new StoreItemCategoryObject());
         }
         var storeItemCategoryObject = ModelCrossMapper.Map <StoreItemCategory, StoreItemCategoryObject>(myItem);
         if (storeItemCategoryObject == null || storeItemCategoryObject.StoreItemCategoryId < 1)
         {
             return(new StoreItemCategoryObject());
         }
         return(storeItemCategoryObject);
     }
     catch (Exception ex)
     {
         ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
         return(new StoreItemCategoryObject());
     }
 }
예제 #5
0
 public AccountGroupObject GetAccountGroup(long accountGroupId)
 {
     try
     {
         var myItem = _repository.GetById(accountGroupId);
         if (myItem == null || myItem.AccountGroupId < 1)
         {
             return(new AccountGroupObject());
         }
         var accountGroupObject = ModelCrossMapper.Map <AccountGroup, AccountGroupObject>(myItem);
         if (accountGroupObject == null || accountGroupObject.AccountGroupId < 1)
         {
             return(new AccountGroupObject());
         }
         return(accountGroupObject);
     }
     catch (Exception ex)
     {
         ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
         return(new AccountGroupObject());
     }
 }
 public DeliveryMethodObject GetDeliveryMethod(long deliveryMethodId)
 {
     try
     {
         var myItem = _repository.GetById(deliveryMethodId);
         if (myItem == null || myItem.DeliveryMethodId < 1)
         {
             return(new DeliveryMethodObject());
         }
         var deliveryMethodObject = ModelCrossMapper.Map <DeliveryMethod, DeliveryMethodObject>(myItem);
         if (deliveryMethodObject == null || deliveryMethodObject.DeliveryMethodId < 1)
         {
             return(new DeliveryMethodObject());
         }
         return(deliveryMethodObject);
     }
     catch (Exception ex)
     {
         ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
         return(new DeliveryMethodObject());
     }
 }
 public SaleTransactionObject GetSaleTransaction(long saleTransactionId)
 {
     try
     {
         var myItem = _repository.GetById(saleTransactionId);
         if (myItem == null || myItem.SaleTransactionId < 1)
         {
             return new SaleTransactionObject();
         }
         var saleTransactionObject = ModelCrossMapper.Map<SaleTransaction, SaleTransactionObject>(myItem);
         if (saleTransactionObject == null || saleTransactionObject.SaleTransactionId < 1)
         {
             return new SaleTransactionObject();
         }
         return saleTransactionObject;
     }
     catch (Exception ex)
     {
         ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
         return new SaleTransactionObject();
     }
 }
예제 #8
0
 public PaymentTypeObject GetPaymentType(long paymentTypeId)
 {
     try
     {
         var myItem = _repository.GetById(paymentTypeId);
         if (myItem == null || myItem.PaymentTypeId < 1)
         {
             return(new PaymentTypeObject());
         }
         var paymentTypeObject = ModelCrossMapper.Map <PaymentType, PaymentTypeObject>(myItem);
         if (paymentTypeObject == null || paymentTypeObject.PaymentTypeId < 1)
         {
             return(new PaymentTypeObject());
         }
         return(paymentTypeObject);
     }
     catch (Exception ex)
     {
         ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
         return(new PaymentTypeObject());
     }
 }
예제 #9
0
 public DocumentTypeObject GetDocumentType(long documentTypeId)
 {
     try
     {
         var myItem = _repository.GetById(documentTypeId);
         if (myItem == null || myItem.DocumentTypeId < 1)
         {
             return(new DocumentTypeObject());
         }
         var documentTypeObject = ModelCrossMapper.Map <DocumentType, DocumentTypeObject>(myItem);
         if (documentTypeObject == null || documentTypeObject.DocumentTypeId < 1)
         {
             return(new DocumentTypeObject());
         }
         return(documentTypeObject);
     }
     catch (Exception ex)
     {
         ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
         return(new DocumentTypeObject());
     }
 }
 public UnitsOfMeasurementObject GetUnitOfMeasurement(long unitOfMeasurementId)
 {
     try
     {
         var myItem = _repository.GetById(unitOfMeasurementId);
         if (myItem == null || myItem.UnitOfMeasurementId < 1)
         {
             return(new UnitsOfMeasurementObject());
         }
         var unitsOfMeasurementObject = ModelCrossMapper.Map <UnitsOfMeasurement, UnitsOfMeasurementObject>(myItem);
         if (unitsOfMeasurementObject == null || unitsOfMeasurementObject.UnitOfMeasurementId < 1)
         {
             return(new UnitsOfMeasurementObject());
         }
         return(unitsOfMeasurementObject);
     }
     catch (Exception ex)
     {
         ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
         return(new UnitsOfMeasurementObject());
     }
 }
예제 #11
0
 public JobRoleObject GetJobRole(long jobRoleId)
 {
     try
     {
         var myItem = _repository.GetById(jobRoleId);
         if (myItem == null || myItem.JobRoleId < 1)
         {
             return(new JobRoleObject());
         }
         var jobRoleObject = ModelCrossMapper.Map <JobRole, JobRoleObject>(myItem);
         if (jobRoleObject == null || jobRoleObject.JobRoleId < 1)
         {
             return(new JobRoleObject());
         }
         return(jobRoleObject);
     }
     catch (Exception ex)
     {
         ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
         return(new JobRoleObject());
     }
 }
예제 #12
0
 public StoreItemTypeObject GetStoreItemType(long productTypeId)
 {
     try
     {
         var myItem = _repository.GetById(productTypeId);
         if (myItem == null || myItem.StoreItemTypeId < 1)
         {
             return(new StoreItemTypeObject());
         }
         var productTypeObject = ModelCrossMapper.Map <StoreItemType, StoreItemTypeObject>(myItem);
         if (productTypeObject == null || productTypeObject.StoreItemTypeId < 1)
         {
             return(new StoreItemTypeObject());
         }
         return(productTypeObject);
     }
     catch (Exception ex)
     {
         ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
         return(new StoreItemTypeObject());
     }
 }
예제 #13
0
 public ImageViewObject GetImageView(long imageViewId)
 {
     try
     {
         var myItem = _repository.GetById(imageViewId);
         if (myItem == null || myItem.ImageViewId < 1)
         {
             return(new ImageViewObject());
         }
         var imageViewObject = ModelCrossMapper.Map <ImageView, ImageViewObject>(myItem);
         if (imageViewObject == null || imageViewObject.ImageViewId < 1)
         {
             return(new ImageViewObject());
         }
         return(imageViewObject);
     }
     catch (Exception ex)
     {
         ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
         return(new ImageViewObject());
     }
 }
예제 #14
0
 public BillingCycleObject GetBillingCycle(long billingCycleId)
 {
     try
     {
         var myItem = _repository.GetById(billingCycleId);
         if (myItem == null || myItem.BillingCycleId < 1)
         {
             return(new BillingCycleObject());
         }
         var billingCycleObject = ModelCrossMapper.Map <BillingCycle, BillingCycleObject>(myItem);
         if (billingCycleObject == null || billingCycleObject.BillingCycleId < 1)
         {
             return(new BillingCycleObject());
         }
         return(billingCycleObject);
     }
     catch (Exception ex)
     {
         ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
         return(new BillingCycleObject());
     }
 }
예제 #15
0
 public BankObject GetBank(long bankId)
 {
     try
     {
         var myItem = _repository.GetById(bankId);
         if (myItem == null || myItem.BankId < 1)
         {
             return(new BankObject());
         }
         var bankObject = ModelCrossMapper.Map <Bank, BankObject>(myItem);
         if (bankObject == null || bankObject.BankId < 1)
         {
             return(new BankObject());
         }
         return(bankObject);
     }
     catch (Exception ex)
     {
         ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
         return(new BankObject());
     }
 }
예제 #16
0
 public StoreContactTagObject GetContactTag(long contactTagId)
 {
     try
     {
         var myItem = _repository.GetById(contactTagId);
         if (myItem == null || myItem.ContactTagId < 1)
         {
             return(new StoreContactTagObject());
         }
         var contactTagObject = ModelCrossMapper.Map <StoreContactTag, StoreContactTagObject>(myItem);
         if (contactTagObject == null || contactTagObject.ContactTagId < 1)
         {
             return(new StoreContactTagObject());
         }
         return(contactTagObject);
     }
     catch (Exception ex)
     {
         ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
         return(new StoreContactTagObject());
     }
 }
 public TransactionTypeObject GetTransactionType(long transactionTypeId)
 {
     try
     {
         var myItem = _repository.GetById(transactionTypeId);
         if (myItem == null || myItem.TransactionTypeId < 1)
         {
             return(new TransactionTypeObject());
         }
         var transactionTypeObject = ModelCrossMapper.Map <TransactionType, TransactionTypeObject>(myItem);
         if (transactionTypeObject == null || transactionTypeObject.TransactionTypeId < 1)
         {
             return(new TransactionTypeObject());
         }
         return(transactionTypeObject);
     }
     catch (Exception ex)
     {
         ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
         return(new TransactionTypeObject());
     }
 }
예제 #18
0
 public AlaCarteObject GetAlaCarte(long alaCarteId)
 {
     try
     {
         var myItem = _repository.GetById(alaCarteId);
         if (myItem == null || myItem.AlaCarteId < 1)
         {
             return(new AlaCarteObject());
         }
         var alaCarteObject = ModelCrossMapper.Map <AlaCarte, AlaCarteObject>(myItem);
         if (alaCarteObject == null || alaCarteObject.AlaCarteId < 1)
         {
             return(new AlaCarteObject());
         }
         return(alaCarteObject);
     }
     catch (Exception ex)
     {
         ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
         return(new AlaCarteObject());
     }
 }
예제 #19
0
 public CityObject GetCity(long cityId)
 {
     try
     {
         var myItem = _repository.GetById(cityId);
         if (myItem == null || myItem.CityId < 1)
         {
             return(new CityObject());
         }
         var cityObject = ModelCrossMapper.Map <City, CityObject>(myItem);
         if (cityObject == null || cityObject.CityId < 1)
         {
             return(new CityObject());
         }
         return(cityObject);
     }
     catch (Exception ex)
     {
         ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
         return(new CityObject());
     }
 }
 public ChartOfAccountObject GetChartOfAccount(long chartOfAccountId)
 {
     try
     {
         var myItem = _repository.GetById(chartOfAccountId);
         if (myItem == null || myItem.ChartOfAccountId < 1)
         {
             return(new ChartOfAccountObject());
         }
         var chartOfAccountObject = ModelCrossMapper.Map <ChartOfAccount, ChartOfAccountObject>(myItem);
         if (chartOfAccountObject == null || chartOfAccountObject.ChartOfAccountId < 1)
         {
             return(new ChartOfAccountObject());
         }
         return(chartOfAccountObject);
     }
     catch (Exception ex)
     {
         ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
         return(new ChartOfAccountObject());
     }
 }
예제 #21
0
 public CouponObject GetCoupon(long couponId)
 {
     try
     {
         var myItem = _repository.GetById(couponId);
         if (myItem == null || myItem.CouponId < 1)
         {
             return(new CouponObject());
         }
         var couponObject = ModelCrossMapper.Map <Coupon, CouponObject>(myItem);
         if (couponObject == null || couponObject.CouponId < 1)
         {
             return(new CouponObject());
         }
         couponObject.ValidityPeriod = couponObject.ValidFrom.ToString("dd/MM/yyyy") + " - " + couponObject.ValidTo.ToString("dd/MM/yyyy");
         return(couponObject);
     }
     catch (Exception ex)
     {
         ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
         return(new CouponObject());
     }
 }
 public SubscriptionPricingObject GetSubscriptionPricing(long subscriptionPricingId)
 {
     try
     {
         var myItem = _repository.GetById(m => m.SubscriptionPricingId == subscriptionPricingId, "BillingCycle, SubscriptionPackage");
         if (myItem == null || myItem.BillingCycleId < 1)
         {
             return(new SubscriptionPricingObject());
         }
         var subscriptionPricingObject = ModelCrossMapper.Map <SubscriptionPricing, SubscriptionPricingObject>(myItem);
         if (subscriptionPricingObject == null || subscriptionPricingObject.SubscriptionPackageId < 1)
         {
             return(new SubscriptionPricingObject());
         }
         subscriptionPricingObject.SubscriptionPackagePackageTitle = myItem.SubscriptionPackage.PackageTitle;
         subscriptionPricingObject.BillingCycleName = myItem.BillingCycle.Name;
         return(subscriptionPricingObject);
     }
     catch (Exception ex)
     {
         ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message);
         return(new SubscriptionPricingObject());
     }
 }