Beispiel #1
0
        public int InsertUpdateStore(StoreEntity storeEntity, int LoggedInUserId)
        {
            SqlParameter[] sqlParameter = new SqlParameter[] {
                new SqlParameter("store_id", storeEntity.store_id)
                , new SqlParameter("LoggedInUserId", LoggedInUserId)
                , new SqlParameter("url", storeEntity.url ?? (object)DBNull.Value)
                , new SqlParameter("name", storeEntity.name ?? DBNull.Value.ToString())
                , new SqlParameter("title", storeEntity.title ?? DBNull.Value.ToString())
                , new SqlParameter("description", storeEntity.description ?? DBNull.Value.ToString())
                , new SqlParameter("terms", storeEntity.terms ?? DBNull.Value.ToString())

                , new SqlParameter("address", storeEntity.address ?? DBNull.Value.ToString())
                , new SqlParameter("email", storeEntity.email ?? DBNull.Value.ToString())
                , new SqlParameter("telephone", storeEntity.telephone ?? DBNull.Value.ToString())
                , new SqlParameter("logo", storeEntity.logo ?? DBNull.Value.ToString())

                , new SqlParameter("meta_title", storeEntity.meta_title ?? DBNull.Value.ToString())
                , new SqlParameter("meta_description", storeEntity.meta_description ?? DBNull.Value.ToString())
                , new SqlParameter("css_overrides", storeEntity.css_overrides ?? DBNull.Value.ToString())
                , new SqlParameter("template", storeEntity.template ?? DBNull.Value.ToString())
                , new SqlParameter("layout", storeEntity.layout ?? DBNull.Value.ToString())

                , new SqlParameter("country_id", storeEntity.country_id)
                , new SqlParameter("language", storeEntity.language ?? DBNull.Value.ToString())
                , new SqlParameter("currency", storeEntity.currency ?? DBNull.Value.ToString())
                , new SqlParameter("county", storeEntity.county ?? DBNull.Value.ToString())
                , new SqlParameter("banner_id", storeEntity.banner_id.HasValue? storeEntity.banner_id.Value:0)
                , new SqlParameter("catalougeIdCsv", storeEntity.catalougeIdCsv ?? DBNull.Value.ToString())
                , new SqlParameter("Is_ImportPoint", storeEntity.Is_ImportPoint ?? (object)DBNull.Value)
                , new SqlParameter("Is_AccessStore", storeEntity.Is_AccessStore ?? (object)DBNull.Value)
            };
            int result = objGenericRepository.ExecuteSQL <int>("InsertUpdateStore", sqlParameter).FirstOrDefault();

            return(result);
        }
Beispiel #2
0
        public IHttpActionResult PutStoreEntity(int id, StoreEntity storeEntity)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != storeEntity.StoreId)
            {
                return(BadRequest());
            }
            storeEntity = GetLoc(storeEntity);

            db.Entry(storeEntity).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StoreEntityExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #3
0
        public static bool ModifyStore(StoreEntity storeEntity)
        {
            int result = 0;

            if (storeEntity != null)
            {
                StoreRepository mr = new StoreRepository();

                StoreInfo storeInfo = TranslateStoreInfo(storeEntity);


                if (storeEntity.SupplierID > 0)
                {
                    storeInfo.ModifyDate = DateTime.Now;
                    result = mr.ModifyStore(storeInfo);
                }
                else
                {
                    storeInfo.CreateDate = DateTime.Now;
                    storeInfo.ModifyDate = DateTime.Now;
                    result = mr.CreateNew(storeInfo);
                }

                List <StoreInfo> miList = mr.GetAllStore();//刷新缓存
                Cache.Add("StoreALL", miList);
            }
            return(result > 0);
        }
 private void PopulateStore(Store store, StoreEntity dbStore)
 {
     //Return all registered methods with store settings
     store.PaymentMethods = _paymentMethodRegistrar.GetAllPaymentMethods();
     foreach (var paymentMethod in store.PaymentMethods)
     {
         var dbStoredPaymentMethod = dbStore.PaymentMethods.FirstOrDefault(x => x.Code.EqualsInvariant(paymentMethod.Code));
         if (dbStoredPaymentMethod != null)
         {
             dbStoredPaymentMethod.ToModel(paymentMethod);
         }
     }
     store.ShippingMethods = _shippingMethodRegistrar.GetAllShippingMethods();
     foreach (var shippingMethod in store.ShippingMethods)
     {
         var dbStoredShippingMethod = dbStore.ShippingMethods.FirstOrDefault(x => x.Code.EqualsInvariant(shippingMethod.Code));
         if (dbStoredShippingMethod != null)
         {
             dbStoredShippingMethod.ToModel(shippingMethod);
         }
     }
     store.TaxProviders = _taxProviderRegistrar.GetAllTaxProviders();
     foreach (var taxProvider in store.TaxProviders)
     {
         var dbStoredTaxProvider = dbStore.TaxProviders.FirstOrDefault(x => x.Code.EqualsInvariant(taxProvider.Code));
         if (dbStoredTaxProvider != null)
         {
             dbStoredTaxProvider.ToModel(taxProvider);
         }
     }
 }
Beispiel #5
0
        private static StoreInfo TranslateStoreInfo(StoreEntity storeEntity)
        {
            StoreInfo storeInfo = new StoreInfo();

            if (storeEntity != null)
            {
                string[] attachmentids = (storeEntity.AttachmentIDs ?? "").Split(',');
                storeInfo.SupplierID    = storeEntity.SupplierID;
                storeInfo.SupplierName  = storeEntity.SupplierName ?? "";
                storeInfo.SupplierCode  = storeEntity.SupplierCode ?? "";
                storeInfo.SupplierType  = storeEntity.SupplierType;
                storeInfo.CityID        = storeEntity.CityID;
                storeInfo.Address       = storeEntity.Address ?? "";
                storeInfo.Telephone     = storeEntity.Telephone ?? "";
                storeInfo.Mobile        = storeEntity.Mobile ?? "";
                storeInfo.StartTime     = storeEntity.StartTime ?? "";
                storeInfo.EndTime       = storeEntity.EndTime ?? "";
                storeInfo.Coordinate    = storeEntity.Coordinate ?? "";
                storeInfo.Status        = storeEntity.Status;
                storeInfo.AttachmentIDs = storeEntity.AttachmentIDs ?? "";
                storeInfo.CreateDate    = storeEntity.CreateDate;
                storeInfo.ModifyDate    = storeEntity.ModifyDate;
                storeInfo.Operator      = storeEntity.Operator;
            }


            return(storeInfo);
        }
Beispiel #6
0
        private static StoreEntity TranslateStoreEntity(StoreInfo storeInfo)
        {
            StoreEntity storeEntity = new StoreEntity();

            if (storeInfo != null)
            {
                storeEntity.SupplierID    = storeInfo.SupplierID;
                storeEntity.SupplierName  = storeInfo.SupplierName ?? "";
                storeEntity.SupplierCode  = storeInfo.SupplierCode ?? "";
                storeEntity.SupplierType  = storeInfo.SupplierType;
                storeEntity.CityID        = storeInfo.CityID;
                storeEntity.Address       = storeInfo.Address ?? "";
                storeEntity.Telephone     = storeInfo.Telephone ?? "";
                storeEntity.Mobile        = storeInfo.Mobile ?? "";
                storeEntity.StartTime     = storeInfo.StartTime ?? "";
                storeEntity.EndTime       = storeInfo.EndTime ?? "";
                storeEntity.Coordinate    = storeInfo.Coordinate ?? "";
                storeEntity.Status        = storeInfo.Status;
                storeEntity.AttachmentIDs = storeInfo.AttachmentIDs ?? "";
                storeEntity.CreateDate    = storeInfo.CreateDate;
                storeEntity.ModifyDate    = storeInfo.ModifyDate;
                storeEntity.Operator      = storeInfo.Operator;
                City city = BaseDataService.GetAllCity().FirstOrDefault(t => t.CityID == storeInfo.CityID) ?? new City();
                List <AttachmentEntity> attachments = BaseDataService.GetAttachmentInfoByKyes(storeInfo.AttachmentIDs);
                storeEntity.CityInfo    = city;
                storeEntity.Attachments = attachments;
                storeEntity.imageUrl    = attachments != null && attachments.Count > 0 ? attachments[0].FilePath : "" + "/Images/store.jpg";
            }


            return(storeEntity);
        }
Beispiel #7
0
        /// <summary>
        /// Function to save a StoreEntity to the database.
        /// </summary>
        /// <param name="storeEntity">StoreEntity to save</param>
        /// <param name="session">User's session identifier.</param>
        /// <returns>null if the StoreEntity was saved successfully, the same StoreEntity otherwise</returns>
        /// <exception cref="ArgumentNullException">
        /// if <paramref name="storeEntity"/> is null.
        /// </exception>
        /// <exception cref="UtnEmallBusinessLogicException">
        /// If an UtnEmallDataAccessException occurs in DataModel.
        /// </exception>
        public StoreEntity Save(StoreEntity storeEntity, string session)
        {
            bool permited = ValidationService.Instance.ValidatePermission(session, "save", "Store");

            if (!permited)
            {
                ExceptionDetail detail = new ExceptionDetail(new UtnEmall.Server.BusinessLogic.UtnEmallPermissionException("The user hasn't permissions to save an entity"));
                throw new FaultException <ExceptionDetail>(detail);
            }

            if (!Validate(storeEntity))
            {
                return(storeEntity);
            }
            try
            {
                // Save storeEntity using data access object
                storeDataAccess.Save(storeEntity);
                return(null);
            }
            catch (UtnEmallDataAccessException utnEmallDataAccessException)
            {
                throw new UtnEmall.Server.BusinessLogic.UtnEmallBusinessLogicException(utnEmallDataAccessException.Message, utnEmallDataAccessException);
            }
        }
Beispiel #8
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(string GUID, string UID, StoreEntity UEntity)
        {
            int result = dal.Update(UEntity);

            //检测执行结果
            CheckResult(result, "");
        }
Beispiel #9
0
        /// <summary>
        /// Obtiene la entidad del usuario y verifica que el usuario posé una tienda asociada.
        /// </summary>
        private bool UserWS(string username)
        {
            // Obtiene la enttidad del usuario.
            List <UserEntity> userList = ServicesClients.User.GetUserWhereEqual(UserEntity.DBUserName, username, true, session);

            if ((userList.Count > 0) && (userList[0].IdStore > 0))
            {
                UserEntity = userList[0];
                // Obtiene la entidad de la tienda.
                StoreEntity storeEntity = ServicesClients.Store.GetStore(UserEntity.IdStore, true, session);

                if (storeEntity != null)
                {
                    UserEntity.Store = storeEntity;
                }

                // Añade el usuario a la sesión, ya que es un usuario válido.
                Session.Add(SessionConstants.User, UserEntity);

                return(true);
            }
            else
            {
                return(false);
            }
        }
        public StoreEntity Save(StoreEntity storeEntity, string session)
        {
            try
            {
                StoreEntity result;
                // if we are connected

                if (Connection.IsConnected)
                {
                    CheckIsSynchronized();
                    result = Remote.Save(storeEntity, session);
                }
                else
                {
                    result = Local.Save(storeEntity);
                }
                return(result);
            }
            catch (UtnEmallDataAccessException dataAccessError)
            {
                throw new UtnEmallSmartLayerException(dataAccessError.Message, dataAccessError);
            }
            catch (UtnEmallBusinessLogicException businessLogicError)
            {
                throw new UtnEmallSmartLayerException(businessLogicError.Message, businessLogicError);
            }
            catch (CommunicationException communicationError)
            {
                throw new UtnEmallSmartLayerException(communicationError.Message, communicationError);
            }
        }
        /// <summary>
        /// Constructor de clase
        /// </summary>
        public StoreEditor()
        {
            this.InitializeComponent();
            store = new StoreEntity();

            Initialize();
        }
Beispiel #12
0
        public List <StoreEntity> Find_List_Store(string storeName, string address, string storeType)
        {
            List <StoreEntity> list = new List <StoreEntity>();

            if (dbContext == null)
            {
                dbContext = new FoodDeliveryEntities();
            }
            var listvar = dbContext.FIND_STORE(storeName, address, storeType).ToList();

            foreach (var obj in listvar)
            {
                StoreEntity entity = new StoreEntity
                {
                    StoreID       = "" + obj.StoreID,
                    StoreName     = obj.StoreName,
                    Address       = obj.Address,
                    OpenDoor      = "" + obj.OpenDoor,
                    CloserDoor    = "" + obj.CloserDoor,
                    ServiceCharge = (decimal)obj.ServiceCharge,
                    ShippingFee   = (decimal)obj.ShippingFee,
                    Manner        = obj.Manner,
                    Website       = obj.Website,
                    StoreType     = obj.StoreType,
                    StoreBanner   = obj.StoreBanner,
                    Rating        = (double)obj.Rating,
                    Evaluation    = (int)obj.Evaluation,
                    ConditionShip = (long)obj.ConditionShip,
                    StartDate     = (int)obj.StartDate,
                    EndDate       = (int)obj.EndDate,
                };
                list.Add(entity);
            }
            return(list);
        }
Beispiel #13
0
        public StoreEntity Get_Object_Store_By_StoreID(string id)
        {
            if (dbContext == null)
            {
                dbContext = new FoodDeliveryEntities();
            }
            var obj = dbContext.GET_OBJECT_STORE_BY_STOREID(id).FirstOrDefault();

            StoreEntity entity = new StoreEntity
            {
                StoreID       = "" + obj.StoreID,
                StoreName     = obj.StoreName,
                Address       = obj.Address,
                OpenDoor      = "" + obj.OpenDoor,
                CloserDoor    = "" + obj.CloserDoor,
                ServiceCharge = (decimal)obj.ServiceCharge,
                ShippingFee   = (decimal)obj.ShippingFee,
                Manner        = obj.Manner,
                Website       = obj.Website,
                StoreType     = obj.StoreType,
                StoreBanner   = obj.StoreBanner,
                Rating        = (double)obj.Rating,
                Evaluation    = (int)obj.Evaluation,
                ConditionShip = (long)obj.ConditionShip,
                StartDate     = (int)obj.StartDate,
                EndDate       = (int)obj.EndDate,
            };


            return(entity);
        }
Beispiel #14
0
        public List <StoreEntity> Get_List_Store()
        {
            List <StoreEntity> list = new List <StoreEntity>();

            if (dbContext == null)
            {
                dbContext = new FoodDeliveryEntities();
            }
            var listvar = dbContext.GET_LIST_STORE().ToList();

            foreach (var obj in listvar)
            {
                StoreEntity entity = new StoreEntity
                {
                    StoreID       = "" + obj.StoreID,
                    StoreName     = obj.StoreName,
                    Address       = obj.Address,
                    OpenDoor      = "" + obj.OpenDoor,
                    CloserDoor    = "" + obj.CloserDoor,
                    ServiceCharge = (decimal)obj.ServiceCharge,
                    ShippingFee   = (decimal)obj.ShippingFee,
                    Manner        = obj.Manner,
                    Website       = obj.Website,
                    StoreType     = obj.StoreType,
                    StoreBanner   = "http://localhost:63116/Data/Originals/t.PNG",
                    Rating        = (double)obj.Rating,
                    Evaluation    = (int)obj.Evaluation,
                    ConditionShip = (long)obj.ConditionShip,
                    StartDate     = (int)obj.StartDate,
                    EndDate       = (int)obj.EndDate,
                };
                list.Add(entity);
            }
            return(list);
        }
Beispiel #15
0
        /// <summary>
        /// Function to delete a StoreEntity from database.
        /// </summary>
        /// <param name="storeEntity">StoreEntity to delete</param>
        /// <param name="session">User's session identifier.</param>
        /// <returns>null if the StoreEntity was deleted successfully, the same StoreEntity otherwise</returns>
        /// <exception cref="ArgumentNullException">
        /// if <paramref name="storeEntity"/> is null.
        /// </exception>
        /// <exception cref="UtnEmallBusinessLogicException">
        /// If an UtnEmallDataAccessException occurs in DataModel.
        /// </exception>
        public StoreEntity Delete(StoreEntity storeEntity, string session)
        {
            bool permited = ValidationService.Instance.ValidatePermission(session, "delete", "Store");

            if (!permited)
            {
                ExceptionDetail detail = new ExceptionDetail(new UtnEmall.Server.BusinessLogic.UtnEmallPermissionException("The user hasn't permissions to delete an entity"));
                throw new FaultException <ExceptionDetail>(detail);
            }

            if (storeEntity == null)
            {
                throw new ArgumentException("The argument can not be null or be empty");
            }
            try
            {
                // Delete storeEntity using data access object
                storeDataAccess.Delete(storeEntity);
                return(null);
            }
            catch (UtnEmallDataAccessException utnEmallDataAccessException)
            {
                throw new UtnEmall.Server.BusinessLogic.UtnEmallBusinessLogicException(utnEmallDataAccessException.Message, utnEmallDataAccessException);
            }
        }
Beispiel #16
0
        /// <summary>
        /// 单行数据转实体对象
        /// </summary>
        /// <param name="dr"></param>
        /// <returns></returns>
        private StoreEntity SetEntityInfo(DataRow dr)
        {
            StoreEntity Entity = new StoreEntity();

            Entity.stoid           = StringHelper.StringToLong(dr["stoid"].ToString());
            Entity.comcode         = dr["comcode"].ToString();
            Entity.stocode         = dr["stocode"].ToString();
            Entity.cname           = dr["cname"].ToString();
            Entity.sname           = dr["sname"].ToString();
            Entity.bcode           = dr["bcode"].ToString();
            Entity.indcode         = dr["indcode"].ToString();
            Entity.provinceid      = StringHelper.StringToInt(dr["provinceid"].ToString());
            Entity.cityid          = StringHelper.StringToInt(dr["cityid"].ToString());
            Entity.areaid          = StringHelper.StringToInt(dr["areaid"].ToString());
            Entity.address         = dr["address"].ToString();
            Entity.stoprincipal    = dr["stoprincipal"].ToString();
            Entity.stoprincipaltel = dr["stoprincipaltel"].ToString();
            Entity.tel             = dr["tel"].ToString();
            Entity.stoemail        = dr["stoemail"].ToString();
            Entity.logo            = dr["logo"].ToString();
            Entity.backgroundimg   = dr["backgroundimg"].ToString();
            //Entity.services = dr["services"].ToString();
            Entity.descr       = dr["descr"].ToString();
            Entity.stourl      = dr["stourl"].ToString();
            Entity.stocoordx   = dr["stocoordx"].ToString();
            Entity.stocoordy   = dr["stocoordy"].ToString();
            Entity.recommended = dr["recommended"].ToString();
            Entity.remark      = dr["remark"].ToString();
            Entity.status      = dr["status"].ToString();
            Entity.cuser       = StringHelper.StringToLong(dr["cuser"].ToString());
            return(Entity);
        }
Beispiel #17
0
        /// <summary>
        /// 检查 entity 为 null的情况
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        private StoreEntity StoreEntityCheck(StoreEntity source)
        {
            source.Description = source.Description ?? String.Empty;
            source.Name        = source.Name ?? String.Empty;

            return(source);
        }
Beispiel #18
0
            public async Task ShouldSetResponseRevisionInRevisionContext_WhenGivenAnIdAndExistingStoreModel()
            {
                // Arrange
                var id = "/test";

                var json        = "{ \"myValue\": \"test\" }";
                var payload     = BsonDocument.Parse(json);
                var storeEntity = new StoreEntity
                {
                    Id       = id,
                    Revision = Guid.NewGuid(),
                    Payload  = payload
                };

                var revisionContext        = new RevisionContext();
                var databaseIntegratorMock = GetDataIntegratorMock(storeEntity);

                var storeRepository = new StoreRepository(databaseIntegratorMock.Object, revisionContext);

                // Act
                var result = await storeRepository.ReadAsync(id, default);

                // Aseert
                revisionContext.ResponseRevision.Should().Be(storeEntity.Revision);
            }
Beispiel #19
0
        /// <summary>
        /// 获取门店列表
        /// </summary>
        public string GetDefaultStoreListData()
        {
            var    service = new StoreBLL(CurrentUserInfo);
            string content = string.Empty;

            string key = string.Empty;

            if (Request("StoreID") != null && Request("StoreID") != string.Empty)
            {
                key = Request("StoreID").ToString().Trim();
            }

            var queryEntity = new StoreEntity();

            queryEntity.StoreID = key;
            int pageIndex = Utils.GetIntVal(FormatParamValue(Request("page"))) - 1;

            var data           = service.GetList(queryEntity, pageIndex, 1000);
            var dataTotalCount = service.GetListCount(queryEntity);

            content = string.Format("{{\"totalCount\":{1},\"topics\":{0}}}",
                                    data.ToJSON(),
                                    dataTotalCount);
            return(content);
        }
Beispiel #20
0
 protected BusinessEntityEntity(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     if (SerializationHelper.Optimization != SerializationOptimization.Fast)
     {
         _businessEntityAddresses = (EntityCollection <BusinessEntityAddressEntity>)info.GetValue("_businessEntityAddresses", typeof(EntityCollection <BusinessEntityAddressEntity>));
         _businessEntityContacts  = (EntityCollection <BusinessEntityContactEntity>)info.GetValue("_businessEntityContacts", typeof(EntityCollection <BusinessEntityContactEntity>));
         _person = (PersonEntity)info.GetValue("_person", typeof(PersonEntity));
         if (_person != null)
         {
             _person.AfterSave += new EventHandler(OnEntityAfterSave);
         }
         _vendor = (VendorEntity)info.GetValue("_vendor", typeof(VendorEntity));
         if (_vendor != null)
         {
             _vendor.AfterSave += new EventHandler(OnEntityAfterSave);
         }
         _store = (StoreEntity)info.GetValue("_store", typeof(StoreEntity));
         if (_store != null)
         {
             _store.AfterSave += new EventHandler(OnEntityAfterSave);
         }
         this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
     }
     // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
     // __LLBLGENPRO_USER_CODE_REGION_END
 }
        public async Task <StoreEntity> GetVendorData()
        {
            JsonValue GetAllStoreUser = await HttpRequestHelper <String> .GetRequest(ServiceTypes.GetAllUsers, SessionHelper.AccessToken);

            StoreEntity AllstoreUserEntity = JsonConvert.DeserializeObject <StoreEntity>(GetAllStoreUser.ToString());

            if (AllstoreUserEntity.IsSuccess)
            {
                List <AvailableVendorModel> lstAllStore = AllstoreUserEntity.lstUserDetails.Select(dc => new AvailableVendorModel()
                {
                    StoreUserId     = dc.StoreUserId,
                    StoreName       = dc.StoreName,
                    Username        = dc.Username,
                    Address         = dc.Address,
                    Active          = false,
                    DeviceId        = dc.DeviceId,
                    Email           = dc.Email,
                    BackgroundColor = "White"
                }).ToList();

                UserDetails = new ObservableCollection <AvailableVendorModel>();

                foreach (AvailableVendorModel getProduct in lstAllStore)
                {
                    UserDetails.Add(getProduct);
                }
            }
            else
            {
                await App.Current.MainPage.DisplayAlert("Error", AllstoreUserEntity.Message, "Ok");
            }
            return(AllstoreUserEntity);
        }
Beispiel #22
0
        public StoreEntity GetStoreEntity(string usCode)
        {
            string      sql    = string.Format(@"SELECT TOP 1 tb_stll.LL0Contact, store.Code,NameZHCN,CityName,MarketName,OpenDate,st.TotalSeatsNo,
			sc.LeasePurchaseTerm,sc.EndDate,RentCommencementDate,sc.RentStructure,sc.RentType,sc.TotalLeasedArea			
			 FROM dbo.Store
			left JOIN
			(SELECT TOP 1* FROM 
			 dbo.StoreContractInfo WHERE StoreCode = '{0}'
			 ORDER BY CreatedTime DESC
			 ) AS SC ON sc.StoreCode = store.Code
			left JOIN StoreSTLocation st ON st.StoreCode = store.Code
	left JOIN (SELECT TOP 1 * FROM StoreSTLLRecord WHERE StoreCode = '{0}'   ORDER BY CreatedTime DESC) 
	AS tb_stll
			ON tb_stll.StoreCode = store.Code
			WHERE Code = '{0}'
			ORDER BY SC.CreatedTime DESC
		"        , usCode);
            StoreEntity entity = null;
            var         list   = SqlQuery <StoreEntity>(sql, null).ToList();

            if (list.Count > 0)
            {
                entity = list[0];
            }
            return(entity);
        }
        /// <summary>
        /// Obtener una lista de pares Service/Cantidad de clicks.
        /// </summary>
        /// <param name="store">La tienda a la cual computar estadísticas.</param>
        /// <param name="session">El identificador de sesión del cliente móvil.</param>
        /// <returns>Un lista de pares nombre/valor.</returns>
        public List <DictionaryEntry> GetCustomersAccessAmountByStore(StoreEntity store, string session)
        {
            List <UserActionEntity>           userActionsPartial  = new List <UserActionEntity>(new UserActionDataAccess().LoadWhere(UserActionEntity.DBActionType, 0, false, OperatorType.Equal));
            Dictionary <int, DictionaryEntry> serviceGroupPartial = new Dictionary <int, DictionaryEntry>();

            // Agrupamos por servicio y contamos
            foreach (UserActionEntity uae in userActionsPartial)
            {
                // Las tiendas deben ser las mismas
                ServiceEntity service = new ServiceDataAccess().Load(uae.IdService, true, null);

                if (service.IdStore == store.Id)
                {
                    DictionaryEntry nameValue;

                    if (serviceGroupPartial.TryGetValue(uae.IdService, out nameValue))
                    {
                        nameValue.Value = Convert.ToString(Convert.ToInt32(nameValue.Value, CultureInfo.InvariantCulture) + 1, CultureInfo.InvariantCulture);
                        serviceGroupPartial[uae.IdService] = nameValue;
                    }
                    else
                    {
                        nameValue       = new DictionaryEntry();
                        nameValue.Key   = service.Name;
                        nameValue.Value = "1";
                        serviceGroupPartial.Add(uae.IdService, nameValue);
                    }
                }
            }

            List <DictionaryEntry> listOfServiceAccesses = new List <DictionaryEntry>(serviceGroupPartial.Values);

            return(listOfServiceAccesses);
        }
Beispiel #24
0
        /// <summary>
        /// Convertir los tipos de datos usados en el cliente a tipos usados en el servidor
        /// </summary>
        /// <param name="listOfRAData">Listado a convertir</param>
        /// <param name="sessionId">Identificador de sesión</param>
        /// <returns>Una colección de asociaciones</returns>
        private static Collection <RegisterAssociationEntity> ConvertFromRegisterAssociationData(Collection <RegisterAssociationData> listOfRegisterAssociationData, string sessionId)
        {
            RegisterAssociation RAClient = new RegisterAssociation();
            Collection <RegisterAssociationEntity> result = new Collection <RegisterAssociationEntity>();

            StoreEntity userStore = SessionManager.Instance.StoreFromUserSession(sessionId);

            // Convertir los objetos de entidad
            foreach (RegisterAssociationData registerAssociation in listOfRegisterAssociationData)
            {
                bool notFound = true;
                RegisterAssociationEntity registerAssociationEntity;
                TableEntity table = ObtainTableEntity(registerAssociation.TableName, userStore, sessionId);

                Collection <RegisterAssociationEntity> tableFilteredRAEntities = RAClient.GetRegisterAssociationWhereEqual(RegisterAssociationEntity.DBIdTable, table.Id.ToString(System.Globalization.NumberFormatInfo.InvariantInfo), sessionId);
                for (int i = 0; i < tableFilteredRAEntities.Count && notFound; i++)
                {
                    registerAssociationEntity = tableFilteredRAEntities[i];

                    if (registerAssociationEntity.IdRegister == registerAssociation.RegisterId)
                    {
                        notFound = false;
                        result.Add(registerAssociationEntity);
                    }
                }

                if (notFound)
                {
                    throw new UtnEmallBusinessLogicException("At least one of the register associations does not exist.");
                }
            }

            return(result);
        }
        public StoreEntity GET_OBJECT_STORE_BY_STOREID(string storeID)
        {
            StoreController objController = new StoreController();
            StoreEntity     entity        = objController.Get_Object_Store_By_StoreID(storeID);

            return(entity);
        }
Beispiel #26
0
        /// <summary>
        /// Obtiene una entidad de tabla, dependiendo del nombre y la tienda.
        /// </summary>
        private static TableEntity ObtainTableEntity(string tableName, StoreEntity store, string sessionId)
        {
            Table businessTableClient       = new Table();
            Collection <TableEntity> tables = businessTableClient.GetTableWhereEqual(TableEntity.DBName, tableName, sessionId);
            TableEntity result = null;

            switch (tables.Count)
            {
            // Lanzar una excepción en el caso de que no exista la tabla.
            case 0:
                throw new UtnEmallBusinessLogicException("The table doesn't exists");

            case 1:
                // La tabla debe tener un nombre
                if (tables[0].Name == tableName)
                {
                    result = tables[0];
                }
                else
                {
                    // Si el nombre de la tabla es diferente, lanzar una excepción
                    throw new UtnEmallBusinessLogicException("The table doesn't exists");
                }
                break;

            // Obtener la tienda propietaria de la tabla
            default:
                BusinessLogic.DataModel      businessDataModelClient = new BusinessLogic.DataModel();
                DataModelEntity              dataModelEntity;
                Collection <DataModelEntity> dataModels = businessDataModelClient.GetDataModelWhereEqual(DataModelEntity.DBIdStore, store.Id.ToString(System.Globalization.NumberFormatInfo.InvariantInfo), true, sessionId);

                // Recorrer el modelo de datos, hasta encontrar la tabla.
                for (int i = 0; i < dataModels.Count && result == null; i++)
                {
                    dataModelEntity = dataModels[i];

                    for (int j = 0; j < dataModelEntity.Tables.Count && result == null; j++)
                    {
                        TableEntity table = dataModelEntity.Tables[j];

                        if (tableName == table.Name)
                        {
                            result = table;
                        }
                    }
                }
                break;
            }

            // Lanzar una excepción si no se pudo encontrar la tabla
            if (result != null)
            {
                return(result);
            }
            else
            {
                throw new UtnEmallBusinessLogicException("The table doesn't exists");
            }
        }
        public string GetRefreshToken(string email)
        {
            string      refreshToken = Generator.GenerateRandomString(10);
            StoreEntity storeEntity  = _storeRepository.GetStoreByEmail(email);
            bool        tokenEntity  = _tokenRepository.UpdateRefreshToken(storeEntity.Id, refreshToken);

            return(refreshToken);
        }
Beispiel #28
0
        /// <summary>Creates a new, empty StoreEntity object.</summary>
        /// <returns>A new, empty StoreEntity object.</returns>
        public override IEntity Create()
        {
            IEntity toReturn = new StoreEntity();

            // __LLBLGENPRO_USER_CODE_REGION_START CreateNewStore
            // __LLBLGENPRO_USER_CODE_REGION_END
            return(toReturn);
        }
 // PUT services/stores/:id
 public bool Put(int id, [FromBody] StoreEntity storeEntity)
 {
     if (id > 0)
     {
         return(_storeService.Update(id, storeEntity));
     }
     return(false);
 }
Beispiel #30
0
        public void Save(string id, string payload)
        {
            var storeEntity = new StoreEntity(id);

            storeEntity.PayLoad = payload;
            TableOperation updateOperation = TableOperation.InsertOrReplace(storeEntity);

            table.Execute(updateOperation);
        }