예제 #1
0
        private SqlParameter AddStructureParamStore(StoreSetupViewModel storeSetup)
        {
            var param = new SqlParameter(DnD.Common.Constants.UDTStoreSetup, SqlDbType.Structured)
            {
                Direction = ParameterDirection.Input,
                TypeName  = DnD.Common.Constants.UDTStoreSetup,
                Value     = BuildStoreSetupData(storeSetup)
            };

            return(param);
        }
예제 #2
0
 public int CreateStoreSetup(StoreSetupViewModel storeSetupViewModel)
 {
     using (var command = _dataBaseRepository.db.GetStoredProcCommand(DnD.Common.Constants.UspCreateStoreSetup))
     {
         SqlParameter sqlparam = new SqlParameter();
         sqlparam = AddStructureParamStore(storeSetupViewModel);
         command.Parameters.Add(sqlparam);
         var customerId = Convert.ToInt32(_dataBaseRepository.db.ExecuteScalar(command));
         return(customerId);
     }
 }
예제 #3
0
 public IHttpActionResult CreateStoreSetup(StoreSetupViewModel storeSetup)
 {
     try
     {
         return(Ok(_storeManager.CreateStoreSetup(storeSetup)));
     }
     catch (Exception ex)
     {
         //LoggerEx.HandleException(LoggingBoundaries.DomainLayer, ex, false);
         return(BadRequest());
     }
 }
예제 #4
0
        private static IEnumerable <SqlDataRecord> BuildStoreSetupData(StoreSetupViewModel storeSetup)
        {
            List <SqlDataRecord> records = new List <SqlDataRecord>();
            SqlDataRecord        record  = StoreSqlDataRecord();

            if (!string.IsNullOrEmpty(storeSetup.StoreName))
            {
                record.SetString(0, storeSetup.StoreName);
            }
            if (!string.IsNullOrEmpty(storeSetup.StoreURL))
            {
                record.SetString(1, storeSetup.StoreURL);
            }
            if (storeSetup.DefaultCurrencyId.HasValue)
            {
                record.SetInt32(2, (int)storeSetup.DefaultCurrencyId.Value);
            }
            if (storeSetup.TimeZoneId.HasValue)
            {
                record.SetInt32(3, (int)storeSetup.TimeZoneId.Value);
            }
            if (storeSetup.DisplayPricesId.HasValue)
            {
                record.SetInt32(4, (int)storeSetup.DisplayPricesId.Value);
            }
            if (storeSetup.SKUGenerationId.HasValue)
            {
                record.SetInt32(5, (int)storeSetup.SKUGenerationId.Value);
            }
            if (!string.IsNullOrEmpty(storeSetup.CurrentSequenceNumber))
            {
                record.SetString(6, storeSetup.CurrentSequenceNumber);
            }
            if (storeSetup.UserSwitchingSecurityId.HasValue)
            {
                record.SetInt32(7, (int)storeSetup.UserSwitchingSecurityId.Value);
            }
            if (storeSetup.IsDiscountAllowedOnReceipt.HasValue)
            {
                record.SetBoolean(8, (bool)storeSetup.IsDiscountAllowedOnReceipt.Value);
            }
            if (storeSetup.IsOutOfStockEmailNotificationAllowed.HasValue)
            {
                record.SetBoolean(9, (bool)storeSetup.IsOutOfStockEmailNotificationAllowed.Value);
            }
            if (storeSetup.IsTipsOrSurchargeAllowed.HasValue)
            {
                record.SetBoolean(10, (bool)storeSetup.IsTipsOrSurchargeAllowed.Value);
            }
            if (storeSetup.IsLaybyAllowed.HasValue)
            {
                record.SetBoolean(11, (bool)storeSetup.IsLaybyAllowed.Value);
            }
            if (storeSetup.IsOnAccountSaleAllowed.HasValue)
            {
                record.SetBoolean(12, (bool)storeSetup.IsOnAccountSaleAllowed.Value);
            }
            if (!string.IsNullOrEmpty(storeSetup.ContactFirstName))
            {
                record.SetString(13, storeSetup.ContactFirstName);
            }
            if (!string.IsNullOrEmpty(storeSetup.ContactLastName))
            {
                record.SetString(14, storeSetup.ContactLastName);
            }
            if (!string.IsNullOrEmpty(storeSetup.Email))
            {
                record.SetString(15, storeSetup.Email);
            }
            if (!string.IsNullOrEmpty(storeSetup.PhoneNumber))
            {
                record.SetString(16, storeSetup.PhoneNumber);
            }
            if (!string.IsNullOrEmpty(storeSetup.Website))
            {
                record.SetString(17, storeSetup.Website);
            }
            if (!string.IsNullOrEmpty(storeSetup.TwitterHandle))
            {
                record.SetString(18, storeSetup.TwitterHandle);
            }
            if (!string.IsNullOrEmpty(storeSetup.FaceBook))
            {
                record.SetString(19, storeSetup.FaceBook);
            }
            if (!string.IsNullOrEmpty(storeSetup.LinkedIn))
            {
                record.SetString(20, storeSetup.LinkedIn);
            }
            if (!string.IsNullOrEmpty(storeSetup.PhysicalAddressStreet1))
            {
                record.SetString(21, storeSetup.PhysicalAddressStreet1);
            }
            if (!string.IsNullOrEmpty(storeSetup.PhysicalAddressStreet2))
            {
                record.SetString(22, storeSetup.PhysicalAddressStreet2);
            }
            if (!string.IsNullOrEmpty(storeSetup.PhysicalSuburb))
            {
                record.SetString(23, storeSetup.PhysicalSuburb);
            }
            if (!string.IsNullOrEmpty(storeSetup.PhysicalCity))
            {
                record.SetString(24, storeSetup.PhysicalCity);
            }
            if (!string.IsNullOrEmpty(storeSetup.PhysicalPostcode))
            {
                record.SetString(25, storeSetup.PhysicalPostcode);
            }
            if (!string.IsNullOrEmpty(storeSetup.PhysicalState))
            {
                record.SetString(26, storeSetup.PhysicalState);
            }
            if (storeSetup.PhysicalCountryId.HasValue)
            {
                record.SetInt32(27, (int)storeSetup.PhysicalCountryId.Value);
            }
            if (storeSetup.IsPostalAddressSameAsPhysicalAddress.HasValue)
            {
                record.SetBoolean(28, (bool)storeSetup.IsPostalAddressSameAsPhysicalAddress.Value);
            }
            if (!string.IsNullOrEmpty(storeSetup.PostalAddressStreet1))
            {
                record.SetString(29, storeSetup.PostalAddressStreet1);
            }
            if (!string.IsNullOrEmpty(storeSetup.PostalAddressStreet2))
            {
                record.SetString(30, storeSetup.PostalAddressStreet2);
            }
            if (!string.IsNullOrEmpty(storeSetup.PostalSuburb))
            {
                record.SetString(31, storeSetup.PostalSuburb);
            }
            if (!string.IsNullOrEmpty(storeSetup.PostalCity))
            {
                record.SetString(32, storeSetup.PostalCity);
            }
            if (!string.IsNullOrEmpty(storeSetup.PostalPostCode))
            {
                record.SetString(33, storeSetup.PostalPostCode);
            }
            if (!string.IsNullOrEmpty(storeSetup.PostalState))
            {
                record.SetString(34, storeSetup.PostalState);
            }
            if (storeSetup.PostalCountryId.HasValue)
            {
                record.SetInt32(35, storeSetup.PostalCountryId.Value);
            }
            //if (storeSetup.CreatedBy.HasValue)
            record.SetInt32(36, 1);                        //storeSetup.CreatedBy.Value
            // if (storeSetup.CreatedOn != null)
            record.SetString(37, DateTime.Now.ToString()); //storeSetup.CreatedOn.ToString()
            //if (storeSetup.UpdatedBy.HasValue)
            record.SetInt32(38, 1);                        //storeSetup.UpdatedBy.Value
            // if (storeSetup.UpdatedOn != null)
            record.SetString(39, DateTime.Now.ToString());
            records.Add(record);
            return(records);
        }
예제 #5
0
 /// <summary>
 /// Create Store Setup
 /// </summary>
 /// <param name="storeSetupViewModel"></param>
 /// <returns></returns>
 public int CreateStoreSetup(StoreSetupViewModel storeSetupViewModel)
 {
     return(_storeRepository.CreateStoreSetup(storeSetupViewModel));
 }