Ejemplo n.º 1
0
 public int Create(StoreModel store)
 {
     return(storeObject.CreateStore(store));
 }
Ejemplo n.º 2
0
 public static Store ToEntity(this StoreModel model)
 {
     return(model.MapTo <StoreModel, Store>());
 }
Ejemplo n.º 3
0
 public static Store ToEntity(this StoreModel model, Store destination)
 {
     return(model.MapTo(destination));
 }
Ejemplo n.º 4
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                StoreModel requestModel = bllUser.ConvertRequestToModel <StoreModel>(new StoreModel());
                if (string.IsNullOrEmpty(requestModel.user_id))
                {
                    resp.code = (int)APIErrCode.PrimaryKeyIncomplete;
                    resp.msg  = "user_id 参数必传";
                    bllUser.ContextResponse(context, resp);
                    return;
                }
                if (string.IsNullOrEmpty(requestModel.store_name))
                {
                    resp.code = (int)APIErrCode.PrimaryKeyIncomplete;
                    resp.msg  = "store_name 参数必传";
                    bllUser.ContextResponse(context, resp);
                    return;
                }
                if (string.IsNullOrEmpty(requestModel.store_tel))
                {
                    resp.code = (int)APIErrCode.PrimaryKeyIncomplete;
                    resp.msg  = "store_tel 参数必传";
                    bllUser.ContextResponse(context, resp);
                    return;
                }
                if (string.IsNullOrEmpty(requestModel.province))
                {
                    resp.code = (int)APIErrCode.PrimaryKeyIncomplete;
                    resp.msg  = "province 参数必传";
                    bllUser.ContextResponse(context, resp);
                    return;
                }
                if (string.IsNullOrEmpty(requestModel.city))
                {
                    resp.code = (int)APIErrCode.PrimaryKeyIncomplete;
                    resp.msg  = "city 参数必传";
                    bllUser.ContextResponse(context, resp);
                    return;
                }
                if (string.IsNullOrEmpty(requestModel.district))
                {
                    resp.code = (int)APIErrCode.PrimaryKeyIncomplete;
                    resp.msg  = "district 参数必传";
                    bllUser.ContextResponse(context, resp);
                    return;
                }
                if (string.IsNullOrEmpty(requestModel.address))
                {
                    resp.code = (int)APIErrCode.PrimaryKeyIncomplete;
                    resp.msg  = "address 参数必传";
                    bllUser.ContextResponse(context, resp);
                    return;
                }
                if (string.IsNullOrEmpty(requestModel.longitude))
                {
                    resp.code = (int)APIErrCode.PrimaryKeyIncomplete;
                    resp.msg  = "longitude  参数必传";
                    bllUser.ContextResponse(context, resp);
                    return;
                }
                if (string.IsNullOrEmpty(requestModel.latitude))
                {
                    resp.code = (int)APIErrCode.PrimaryKeyIncomplete;
                    resp.msg  = "latitude  参数必传";
                    bllUser.ContextResponse(context, resp);
                    return;
                }
                if (string.IsNullOrEmpty(requestModel.password))
                {
                    requestModel.password         = ZentCloud.Common.Rand.Str_char(12);
                    requestModel.password_confirm = requestModel.password;
                }
                string permissionGroupId = ZentCloud.Common.ConfigHelper.GetConfigString("SupplierPermissionGroupId");
                string msg           = "";
                bool   addUserResult = bllUser.AddSupplier(requestModel.user_id, requestModel.password, requestModel.password_confirm, requestModel.store_name, "", requestModel.store_tel, "", "", permissionGroupId, requestModel.store_image, requestModel.store_image, "", "", "", "", out msg, requestModel.address, requestModel.province, "", requestModel.city, "", requestModel.district, "", "", "");

                if (addUserResult)
                {
                    #region 添加门店
                    UserInfo supplierInfo = bllUser.GetUserInfo(requestModel.user_id, bllUser.WebsiteOwner);
                    //添加门店表
                    JuActivityInfo pInfo = new JuActivityInfo();
                    pInfo.JuActivityID    = int.Parse(bllUser.GetGUID(BLLJIMP.TransacType.ActivityAdd));
                    pInfo.ActivityName    = requestModel.store_name;
                    pInfo.ActivityAddress = requestModel.address;
                    //pInfo.ServerTimeMsg = requestModel.server_time;
                    //pInfo.ServicesMsg = requestModel.server_msg;
                    pInfo.ThumbnailsPath = requestModel.store_image;
                    pInfo.ArticleType    = "Outlets";
                    // pInfo.CategoryId = requestModel.cate_id;
                    pInfo.Province = requestModel.province;
                    //pInfo.ProvinceCode = requestModel.province_code;
                    pInfo.City = requestModel.city;
                    //pInfo.CityCode = requestModel.city_code;
                    pInfo.District = requestModel.district;
                    //pInfo.DistrictCode = requestModel.district_code;
                    //pInfo.K1 = requestModel.k1;
                    pInfo.K4 = requestModel.store_tel;
                    pInfo.K5 = supplierInfo.AutoID.ToString();
                    //pInfo.Tags = requestModel.tags;
                    //pInfo.Sort = requestModel.sort;
                    pInfo.UserLongitude  = requestModel.longitude;
                    pInfo.UserLatitude   = requestModel.latitude;
                    pInfo.IsHide         = 0;
                    pInfo.CreateDate     = DateTime.Now;
                    pInfo.LastUpdateDate = DateTime.Now;
                    pInfo.WebsiteOwner   = bllUser.WebsiteOwner;
                    pInfo.UserID         = bllUser.WebsiteOwner;
                    pInfo.ServerTimeMsg  = requestModel.server_time;
                    if (bllUser.Add(pInfo))
                    {
                        resp.status = true;
                        resp.msg    = "ok";
                        resp.result = new { store_id = supplierInfo.AutoID };
                    }
                    else
                    {
                        resp.msg = "添加门店失败";
                    }


                    //添加门店表
                    #endregion
                }
                else
                {
                    resp.msg = "添加账户失败";
                    resp.msg = msg;
                }
            }
            catch (Exception ex)
            {
                resp.msg    = ex.Message;
                resp.result = ex.ToString();
            }
            bllUser.ContextResponse(context, resp);
        }
Ejemplo n.º 5
0
        public IActionResult Index(StoreModel model)
        {
            var newModel = mockDataService.GetStoreModel(model);

            return(View(newModel));
        }
        public List <StoreModel> SearchAll(PagingModel page, string fromDate, string toDate, out int total)
        {
            if (page == null)
            {
                page = new PagingModel {
                    offset = 0, limit = 100
                }
            }
            ;
            if (page.search == null)
            {
                page.search = "";
            }
            var model = new List <StoreModel>();

            using (var db = _connectionData.OpenDbConnection())
            {
                var query = db.From <Vw_Store>();
                //anh co the viet ntn. em chua biet. truoc hay sau phan tran anh nhỉ.
                // tat nhien la sau han trang riu
                //vi du
                // cai group no nam o dau
                if (!comm.IsSuperAdmin())
                {
                    query = query.Where(e => e.SysHotelID == comm.GetHotelId());
                }
                query.OrderByDescending(x => x.ID);
                var count = query.ToCountStatement();
                total = db.Select <int>(count).FirstOrDefault();
                var offset = 0; try { offset = page.offset; }
                catch
                {
                    // ignored
                }
                int limit = 10;//int.Parse(Request.Params["limit"]);
                try { limit = page.limit; }
                catch
                {
                    // ignored
                }
                var lst = db.Select(query).Skip(offset).Take(limit).ToList();
                //cho nay ra lít da phan anhaj

                //var test = lst.FirstOrDefault();
                //test.//goi face nc anh nhe ok
                var group = lst.Select(x => new { x.ProductGroupID, x.GroupName }).GroupBy(x => x).ToList();
                // model.AddRange(group.Select(x=>new StoreModel {GroupId = x.Key.ProductGroupID.Value,GroupName = x.Key.GroupName}).ToList());
                // get item theo grupId
                foreach (var item in group)
                {
                    var gr = new StoreModel
                    {
                        GroupId   = item.Key.ProductGroupID.Value,
                        GroupName = item.Key.GroupName
                    };
                    gr.ListItemStores.AddRange(lst.Where(x => x.ProductGroupID == item.Key.ProductGroupID));
                    model.Add(gr);
                }
                return(model);
            }
        }
Ejemplo n.º 7
0
        //string path = "http://103.233.79.234/Data/SJB_Android/StorePictures/";

        //public IEnumerable<StoreModel> GetAllStoreByLocality(int localityid, int loginId)
        //{
        //    List<StoreModel> stores = new List<StoreModel>();
        //    StoreModel store = new StoreModel();
        //    using (sjb_androidEntities context = new sjb_androidEntities())
        //    {
        //        bool fav;
        //        var favouriteStore = (from s in context.storemasters
        //                              join u in context.registrationmasters on s.StoreId equals u.FavouriteStoreId into jointable
        //                              from z in jointable.DefaultIfEmpty()
        //                                  //join l in context.localitymasters on s.StoreId equals l.StoreId1 into j1
        //                                  //from j2 in j1.DefaultIfEmpty()
        //                                  //join l in context.localitymasters on s.StoreId equals l.StoreId2 into j3
        //                                  //from j4 in j1.DefaultIfEmpty()
        //                                  //join l in context.localitymasters on s.StoreId equals l.StoreId1 into j5
        //                                  //from j6 in j1.DefaultIfEmpty()
        //                              where s.LocalityId == localityid && z.LoginID == loginId
        //                              orderby s.StoreName
        //                              select z.FavouriteStoreId).SingleOrDefault();
        //        stores = (from s in context.storemasters
        //                  where s.LocalityId == localityid
        //                  select new StoreModel()
        //                  {
        //                      StoreId = s.StoreId,
        //                      StoreName = s.StoreName,
        //                      StoreEmailId = s.StoreEmailId,
        //                      StorePhoneNumber = s.StorePhoneNumber,
        //                      StoreAddress = s.StoreAddress,
        //                      StorePicturesUrl = path + s.StoreId + "StorePictures.jpg",
        //                      FavouriteStore = s.StoreId == favouriteStore ? true : false,
        //                  }).ToList();

        //    }
        //    return stores;
        //}

        public IEnumerable <StoreModel> GetAllStoreByLocality(int localityid, int loginId)
        {
            List <StoreModel> stores = new List <StoreModel>();
            StoreModel        store  = new StoreModel();

            using (sjb_androidEntities context = new sjb_androidEntities())
            {
                bool fav;
                var  favouriteStore = (from s in context.storemasters
                                       join u in context.registrationmasters on s.StoreId equals u.FavouriteStoreId into jointable
                                       from z in jointable.DefaultIfEmpty()
                                       //join l in context.localitymasters on s.StoreId equals l.StoreId1 into j1
                                       //from j2 in j1.DefaultIfEmpty()
                                       //join l in context.localitymasters on s.StoreId equals l.StoreId2 into j3
                                       //from j4 in j1.DefaultIfEmpty()
                                       //join l in context.localitymasters on s.StoreId equals l.StoreId1 into j5
                                       //from j6 in j1.DefaultIfEmpty()
                                       where z.LoginID == loginId && s.StoreStatus == "Y"
                                       orderby s.StoreName
                                       select z.FavouriteStoreId).SingleOrDefault();
                var result = context.localitymasters.Where(s => s.LocalityId == localityid).FirstOrDefault();
                if (result.StoreId1 > 0)
                {
                    store = (from s in context.storemasters
                             where s.StoreId == result.StoreId1
                             select new StoreModel()
                    {
                        StoreId = s.StoreId,
                        StoreName = s.StoreName,
                        StoreEmailId = s.StoreEmailId,
                        StorePhoneNumber = s.StorePhoneNumber,
                        StoreAddress = s.StoreAddress,
                        LocalityId = result.LocalityId,
                        OpeningTime = (DateTime)s.OpeningTime,
                        ClosingTime = (DateTime)s.ClosingTime,
                        StoreStatus = s.StoreStatus == "Y" ? true : false,
                        StorePicturesUrl = "http://103.233.79.234/Data/SJB_Android/StorePictures/" + s.StoreId + ".jpg",
                        //StorePicturesUrl = path + s.StoreId + "StorePictures.jpg",
                        FavouriteStore = s.StoreId == favouriteStore ? true : false,
                    }).FirstOrDefault();
                    stores.Add(store);
                }
                if (result.StoreId2 > 0)
                {
                    store = (from s in context.storemasters
                             where s.StoreId == result.StoreId2
                             select new StoreModel()
                    {
                        StoreId = s.StoreId,
                        StoreName = s.StoreName,
                        StoreEmailId = s.StoreEmailId,
                        StorePhoneNumber = s.StorePhoneNumber,
                        StoreAddress = s.StoreAddress,
                        OpeningTime = (DateTime)s.OpeningTime,
                        ClosingTime = (DateTime)s.ClosingTime,
                        StoreStatus = s.StoreStatus == "Y" ? true : false,
                        LocalityId = result.LocalityId,
                        StorePicturesUrl = "http://103.233.79.234/Data/SJB_Android/StorePictures/" + s.StoreId + ".jpg",
                        FavouriteStore = s.StoreId == favouriteStore ? true : false,
                    }).FirstOrDefault();
                    stores.Add(store);
                }
                if (result.StoreId3 > 0)
                {
                    store = (from s in context.storemasters
                             where s.StoreId == result.StoreId3
                             select new StoreModel()
                    {
                        StoreId = s.StoreId,
                        StoreName = s.StoreName,
                        StoreEmailId = s.StoreEmailId,
                        StorePhoneNumber = s.StorePhoneNumber,
                        StoreAddress = s.StoreAddress,
                        OpeningTime = (DateTime)s.OpeningTime,
                        ClosingTime = (DateTime)s.ClosingTime,
                        StoreStatus = s.StoreStatus == "Y" ? true : false,
                        LocalityId = result.LocalityId,
                        StorePicturesUrl = "http://103.233.79.234/Data/SJB_Android/StorePictures/" + s.StoreId + ".jpg",
                        FavouriteStore = s.StoreId == favouriteStore ? true : false,
                    }).FirstOrDefault();
                    stores.Add(store);
                }
            }
            return(stores);
        }
Ejemplo n.º 8
0
 public static Store ToEntity(this StoreModel model, Store destination)
 {
     return(Mapper.Map(model, destination));
 }
Ejemplo n.º 9
0
        public virtual StoreModel PrepareStoreModel()
        {
            var model = new StoreModel();

            return(model);
        }
Ejemplo n.º 10
0
 public void Put(Guid id, [FromBody] StoreModel model)
 {
 }
Ejemplo n.º 11
0
 public static Store ToEntity(this StoreModel model)
 {
     return(Mapper.Map <StoreModel, Store>(model));
 }
Ejemplo n.º 12
0
        protected virtual List <LocalizedProperty> UpdateAttributeLocales(Store store, StoreModel model)
        {
            List <LocalizedProperty> localized = new List <LocalizedProperty>();

            foreach (var local in model.Locales)
            {
                localized.Add(new LocalizedProperty()
                {
                    LanguageId  = local.LanguageId,
                    LocaleKey   = "Name",
                    LocaleValue = local.Name
                });
            }
            return(localized);
        }
Ejemplo n.º 13
0
        public async Task <Tuple <bool, IpRateLimitServiceResponse> > Validate(TimeSpan span, int limit, string groupKey)
        {
            string clientIp = CommonUtils.GetClientIP(_settings, _httpContext);

            if (string.IsNullOrWhiteSpace(clientIp))
            {
                return(new Tuple <bool, IpRateLimitServiceResponse>(true, null));
            }


            if (_settings.ExcludeList != null)
            {
                IPAddress address = IPAddress.Parse(clientIp);
                foreach (string exculedIps in _settings.ExcludeList)
                {
                    if (exculedIps.Contains("/") && address.IsInSubnet(exculedIps))
                    {
                        return(new Tuple <bool, IpRateLimitServiceResponse>(true, null));
                    }
                    if (exculedIps == clientIp)
                    {
                        return(new Tuple <bool, IpRateLimitServiceResponse>(true, null));
                    }
                }
            }

            DateTime now  = DateTime.UtcNow;
            string   path = CommonUtils.GetPath(_httpContext);
            string   key  = string.Empty;

            if (string.IsNullOrWhiteSpace(groupKey))
            {
                key = CommonUtils.GetKey(clientIp, path);
            }
            else
            {
                key = CommonUtils.GetKey(clientIp, groupKey);
            }
            StoreModel model = await _provider.GetAsync <StoreModel>(key);

            if (model == null)
            {
                model = new StoreModel
                {
                    Entries  = new List <DateTime>(),
                    Path     = path,
                    ClientIp = clientIp
                };
            }
            await Task.Run(() => { model.Entries.RemoveAll(x => x.Add(span) < now); });

            DateTime firstDate = now.Add(span);

            if (model.Entries.Any())
            {
                firstDate = model.Entries.First();
                firstDate = firstDate.Add(span);
            }
            if (model.Entries.Count >= limit)
            {
                return(new Tuple <bool, IpRateLimitServiceResponse>(false, new IpRateLimitServiceResponse {
                    ResetIn = firstDate, MaxLimit = limit, Period = span.TotalSeconds
                }));
            }
            model.Entries.Add(now);
            await _provider.SetAsync(key, model, span);

            return(new Tuple <bool, IpRateLimitServiceResponse>(true, new IpRateLimitServiceResponse {
                AvaliableLimit = limit - model.Entries.Count, ResetIn = firstDate, Period = span.TotalSeconds
            }));
        }
        public async Task <Tuple <bool, APIRateLimiterUserIdServiceResponse> > Validate(TimeSpan span, long limit, string groupKey)
        {
            string clientId = CommonUtils.GetUserId(_settings, _httpContext);

            if (string.IsNullOrWhiteSpace(clientId))
            {
                return(new Tuple <bool, APIRateLimiterUserIdServiceResponse>(true, null));
            }


            if (_settings.ExcludeList != null)
            {
                foreach (string exculedIps in _settings.ExcludeList)
                {
                    if (exculedIps == clientId)
                    {
                        return(new Tuple <bool, APIRateLimiterUserIdServiceResponse>(true, null));
                    }
                }
            }

            DateTime now     = DateTime.UtcNow;
            string   path    = CommonUtils.GetPath(_httpContext);
            string   key     = string.Empty;
            bool     isGroup = !string.IsNullOrWhiteSpace(groupKey);

            key = CommonUtils.GetKey(clientId);
            StoreModel model = await _provider.GetAsync <StoreModel>(key);

            if (model == null)
            {
                model = new StoreModel
                {
                    PathEntries  = new Dictionary <string, StoreEntries>(),
                    GroupEntries = new Dictionary <string, StoreEntries>(),
                    ClientId     = clientId
                };
            }

            var keyOfPathOrGroup = CommonUtils.GetKey(isGroup ? groupKey : path);

            long         spanedOutNow = now.Ticks - span.Ticks;
            StoreEntries storeentry   = new StoreEntries();

            if (isGroup)
            {
                model.GroupEntries.TryGetValue(keyOfPathOrGroup, out storeentry);
            }
            else
            {
                model.PathEntries.TryGetValue(keyOfPathOrGroup, out storeentry);
            }
            if (storeentry == null)
            {
                storeentry = new StoreEntries();
            }

            await Task.Run(() => { storeentry.Entries.RemoveWhere(x => x < spanedOutNow); });

            DateTime firstDate = now.Add(span);

            if (storeentry.Entries.Any())
            {
                firstDate = new DateTime(storeentry.Entries.First());
                firstDate = firstDate.Add(span);
            }

            limit = storeentry.LimitSetByAdmin ?? limit;
            if (storeentry.Entries.Count >= limit)
            {
                return(new Tuple <bool, APIRateLimiterUserIdServiceResponse>(false, new APIRateLimiterUserIdServiceResponse {
                    ResetIn = firstDate, MaxLimit = limit, Period = span.TotalSeconds
                }));
            }
            storeentry.Entries.Add(now.Ticks);
            if (isGroup)
            {
                model.GroupEntries.Remove(keyOfPathOrGroup);
                model.GroupEntries.Add(keyOfPathOrGroup, storeentry);
            }
            else
            {
                model.PathEntries.Remove(keyOfPathOrGroup);
                model.PathEntries.Add(keyOfPathOrGroup, storeentry);
            }

            await _provider.SetAsync(key, model);

            return(new Tuple <bool, APIRateLimiterUserIdServiceResponse>(true, new APIRateLimiterUserIdServiceResponse {
                AvaliableLimit = limit - storeentry.Entries.Count, ResetIn = firstDate, Period = span.TotalSeconds
            }));
        }
Ejemplo n.º 15
0
 public int Edit(StoreModel store)
 {
     return(storeObject.UpdateStore(store));
 }
Ejemplo n.º 16
0
        public static StoreModel GetTestStore(
            string connectionString,
            string countryName,
            string storeStatusName,
            int andromedaSiteId,
            string customerSiteId,
            string externalSiteId,
            string externalSiteName,
            string clientSiteName,
            DateTime lastFTPUploadDateTime,
            string name,
            string telephone,
            string timezone,
            Address address)
        {
            Country     country     = null;
            StoreStatus storeStatus = null;

            using (AndroAdminDataAccess.EntityFramework.AndroAdminEntities entitiesContext = new AndroAdminDataAccess.EntityFramework.AndroAdminEntities())
            {
                entitiesContext.Database.Connection.ConnectionString = connectionString;

                // Get a country for our test store
                var countryQuery = from s in entitiesContext.Countries
                                   where s.CountryName == countryName
                                   select s;

                AndroAdminDataAccess.EntityFramework.Country countryEntity = countryQuery.FirstOrDefault();

                // Does the country exist?
                Assert.IsNotNull(countryEntity, "Unknown country name");

                country = new Country()
                {
                    Id                = countryEntity.Id,
                    CountryName       = countryEntity.CountryName,
                    ISO3166_1_alpha_2 = countryEntity.ISO3166_1_alpha_2,
                    ISO3166_1_numeric = countryEntity.ISO3166_1_numeric
                };

                // Get a store status for our test store
                var storeStatusQuery = from s in entitiesContext.StoreStatus
                                       where s.Status == storeStatusName
                                       select s;

                AndroAdminDataAccess.EntityFramework.StoreStatu storeStatusEntity = storeStatusQuery.FirstOrDefault();

                // Does the store status exist?
                Assert.IsNotNull(storeStatusEntity, "Unknown store status");

                storeStatus = new StoreStatus()
                {
                    Id          = storeStatusEntity.Id,
                    Description = storeStatusEntity.Description,
                    Status      = storeStatusEntity.Status,
                };
            }

            // We need to set the address country
            address.Country = country;

            // Create a new store
            StoreModel storeModel = new StoreModel()
            {
                Store = new Store()
                {
                    AndromedaSiteId       = andromedaSiteId,
                    Address               = address,
                    CustomerSiteId        = customerSiteId,
                    CustomerSiteName      = clientSiteName,
                    ExternalSiteId        = externalSiteId,
                    ExternalSiteName      = externalSiteName,
                    LastFTPUploadDateTime = lastFTPUploadDateTime,
                    Name        = name,
                    StoreStatus = storeStatus,
                    Telephone   = telephone,
                    TimeZone    = timezone
                },
                Selected = true
            };

            return(storeModel);
        }
Ejemplo n.º 17
0
 public void SetStoreModel(StoreModel storeModel)
 {
     throw new NotImplementedException();
 }
 public void Add(StoreModel model)
 {
     Models.Add(model);
 }
Ejemplo n.º 19
0
        public StoreModel AddUpdateFavouriteStoreByUser(int loginid, int storeid)
        {
            StoreModel store = new StoreModel();

            using (sjb_androidEntities context = new sjb_androidEntities())
            {
                if (loginid > 0 && storeid > 0)
                {
                    var data = context.registrationmasters.Where(w => w.LoginID.Equals(loginid));
                    foreach (var item in data)
                    {
                        item.FavouriteStoreId = storeid;
                    }
                    try
                    {
                        var resultdata = context.SaveChanges();
                        if (resultdata > 0)
                        {
                            var favouriteStore = (from s in context.storemasters
                                                  join u in context.registrationmasters on s.StoreId equals u.FavouriteStoreId into jointable
                                                  from z in jointable.DefaultIfEmpty()
                                                  //join l in context.localitymasters on s.StoreId equals l.StoreId1 into j1
                                                  //from j2 in j1.DefaultIfEmpty()
                                                  //join l in context.localitymasters on s.StoreId equals l.StoreId2 into j3
                                                  //from j4 in j1.DefaultIfEmpty()
                                                  //join l in context.localitymasters on s.StoreId equals l.StoreId1 into j5
                                                  //from j6 in j1.DefaultIfEmpty()
                                                  where z.LoginID == loginid && s.StoreStatus == "Y"
                                                  orderby s.StoreName
                                                  select z.FavouriteStoreId).SingleOrDefault();
                            var result = (from u in context.registrationmasters
                                          join s in context.storemasters on u.FavouriteStoreId equals s.StoreId
                                          where u.LoginID == (long)loginid && u.FavouriteStoreId == storeid
                                          select new StoreModel()
                            {
                                StoreId = s.StoreId,
                                StoreName = s.StoreName,
                                StoreStatus = s.StoreStatus == "Y" ? true : false,
                                OpeningTime = (DateTime)s.OpeningTime,
                                ClosingTime = (DateTime)s.ClosingTime,
                                StoreEmailId = s.StoreEmailId,
                                StorePhoneNumber = s.StorePhoneNumber,
                                StoreAddress = s.StoreAddress,
                                StorePicturesUrl = "http://103.233.79.234/Data/SJB_Android/StorePictures/" + s.StoreId + ".jpg",
                                FavouriteStore = s.StoreId == favouriteStore ? true : false,
                            }).FirstOrDefault();
                            store = result;
                        }
                        else
                        {
                            var favouriteStore = (from s in context.storemasters
                                                  join u in context.registrationmasters on s.StoreId equals u.FavouriteStoreId into jointable
                                                  from z in jointable.DefaultIfEmpty()
                                                  //join l in context.localitymasters on s.StoreId equals l.StoreId1 into j1
                                                  //from j2 in j1.DefaultIfEmpty()
                                                  //join l in context.localitymasters on s.StoreId equals l.StoreId2 into j3
                                                  //from j4 in j1.DefaultIfEmpty()
                                                  //join l in context.localitymasters on s.StoreId equals l.StoreId1 into j5
                                                  //from j6 in j1.DefaultIfEmpty()
                                                  where z.LoginID == loginid && s.StoreStatus == "Y"
                                                  orderby s.StoreName
                                                  select z.FavouriteStoreId).SingleOrDefault();
                            var result = (from u in context.registrationmasters
                                          join s in context.storemasters on u.FavouriteStoreId equals s.StoreId
                                          where u.LoginID == (long)loginid && u.FavouriteStoreId == storeid
                                          select new StoreModel()
                            {
                                StoreId = s.StoreId,
                                StoreName = s.StoreName,
                                StoreStatus = s.StoreStatus == "Y" ? true : false,
                                OpeningTime = (DateTime)s.OpeningTime,
                                ClosingTime = (DateTime)s.ClosingTime,
                                StoreEmailId = s.StoreEmailId,
                                StorePhoneNumber = s.StorePhoneNumber,
                                StoreAddress = s.StoreAddress,
                                StorePicturesUrl = "http://103.233.79.234/Data/SJB_Android/StorePictures/" + s.StoreId + ".jpg",
                                FavouriteStore = s.StoreId == favouriteStore ? true : false,
                            }).FirstOrDefault();
                            store = result;
                        }
                    }
                    catch (Exception ex)
                    {
                        //Handle ex
                    }
                }
            }
            return(store);
        }
        public void Update(StoreModel model)
        {
            var memoryModel = Get(model.Id);

            memoryModel.Update(model);
        }
Ejemplo n.º 21
0
 public bool Valid(StoreModel.TrayPackView obj)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 22
0
 public StoreSlotPage(StoreModel SelectedStore)
 {
     InitializeComponent();
     BindingContext = new StoreSlotViewModel(Navigation, SelectedStore);
 }