public Setting(Config.Config config) { this.config = config; stores = new Stores(this); hosts = new Hosts(this); rules = new Rules(this); }
private async Task ExecuteGetStoresCommand() { if (IsBusy) { return; } if (ForceSync) { Settings.LastSync = DateTime.Now.AddDays(-30); } IsBusy = true; GetStoresCommand.ChangeCanExecute(); var showAlert = false; try { Stores.Clear(); var stores = await dataStore.GetStoresAsync(); Stores.ReplaceRange(stores); Sort(); } catch (Exception ex) { showAlert = true; } finally { IsBusy = false; GetStoresCommand.ChangeCanExecute(); } if (showAlert) { await page.DisplayAlert("Uh Oh :(", "Unable to gather stores.", "OK"); } }
void GetStores() { Stores.Add(new Store() { name = "McDonalds", link = "https://www.mcdonalds.com/us/en-us.html", image = "mcdonalds.png" }); Stores.Add(new Store() { name = "Magalu", link = "https://www.magazineluiza.com.br/", image = "Magazine_Logo.png" }); Stores.Add(new Store() { name = "Americanas", link = "https://www.americanas.com.br/", image = "logo_ame.png" }); Stores.Add(new Store() { name = "Amazon", link = "https://www.amazon.com/", image = "amazon.png" }); Stores.Add(new Store() { name = "Starbucks", link = "https://www.starbucks.com/", image = "starbucks.png" }); foreach (var item in Stores) { StoresSearch.Add(item); } }
/// <summary> /// Loads the lookups /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ManageItems_Load(object sender, EventArgs e) { PopulateCatTree(_selectedType); DataTable table = new DataTable(); table = BLL.Type.GetAllTypes(); DataRow row = table.NewRow(); row["ID"] = "0"; row["Name"] = "All"; table.Rows.InsertAt(row, 0); lkCommodityTypes.Properties.DataSource = table; // Select the very first commodity type. lkCommodityTypes.ItemIndex = 0; //DateTime xx = dtDate.Value; dtDate.Value = DateTime.Now; dtDate.CustomFormat = "MM/dd/yyyy"; _dtCurrent = ConvertDate.DateConverter(dtDate.Text); // dtDate.Value = xx; var stor = new Stores(); stor.GetActiveStores(); cboStores.Properties.DataSource = stor.DefaultView; cboStores.ItemIndex = 0; dtDate.Value = DateTime.Now; dtDate.CustomFormat = "MM/dd/yyyy"; _dtCurrent = ConvertDate.DateConverter(dtDate.Text); DataTable dtYear = Items.AllYearsReport(); DataRow roww = dtYear.NewRow(); roww["year"] = "All"; dtYear.Rows.InsertAt(roww, 0); cboYear.Properties.DataSource = dtYear; cboYear.ItemIndex = 0; gridItemListView.Columns["InternalDrugCode"].Visible = Convert.ToBoolean(chkIntDrugCode.EditValue); gridItemListView.Columns["QuantityLeft"].FilterInfo = new ColumnFilterInfo("[QuantityLeft] <> '0'"); }
internal static List <Guid> CalculateClusterTo(Data.Models.WebSite WebSite) { HashSet <Guid> result = new HashSet <Guid>(); var store = Stores.ClusterNodes(WebSite.SiteDb()); var allitems = store.Filter.SelectAll().OrderBy(o => o.ServerUrl).ToList(); var count = allitems.Count(); if (count == 0) { return(new List <Guid>()); } int currentposition = -1; for (int i = 0; i < count; i++) { if (allitems[i].ServerWebSiteId == WebSite.Id) { currentposition = i; } } int one = currentposition + 1; int two = one + 2; int three = two + 4; one = CorrectIndex(one, count); two = CorrectIndex(two, count); three = CorrectIndex(three, count); result.Add(allitems[one].Id); result.Add(allitems[two].Id); result.Add(allitems[three].Id); if (currentposition > -1) { result.Remove(allitems[currentposition].Id); } return(result.ToList()); }
void GetStores() { Stores.Add(new Store() { name = "McDonalds", link = "https://www.mcdonalds.com/us/en-us.html", image = "mcdonalds.png" }); Stores.Add(new Store() { name = "Careem", link = "https://www.careem.com/", image = "careem.png" }); Stores.Add(new Store() { name = "Centrepoint", link = "https://www.centrepointstores.com/", image = "centrepoint.png" }); Stores.Add(new Store() { name = "Amazon", link = "https://www.amazon.com/", image = "amazon.png" }); Stores.Add(new Store() { name = "Starbucks", link = "https://www.starbucks.com/", image = "starbucks.png" }); foreach (var item in Stores) { StoresSearch.Add(item); } }
public IActionResult CreateStore([FromBody] StoresVM storeVm) { if (storeVm == null || string.IsNullOrEmpty(storeVm.Store_name) || string.IsNullOrEmpty(storeVm.Token)) { return(Ok(new { success = false, message = "Недопустимый формат" })); } var userId = _userRepository.GetByToken(storeVm.Token); var store = new Stores { UserId = userId.Id, Store_name = storeVm.Store_name, Description = storeVm.Description, Type = storeVm.Type }; _storesRepository.Add(store); return(Ok(new { success = true, message = "Новый магазин успешно создан" })); }
public int?InsertStore(Store store) { using (var db = new DB()) { if (store == null) { throw new Exception("Store NULL exception"); } var st = new Stores() { Name = store.Name, Description = store.Description }; db.Stores.Add(st); db.SaveChanges(); db.Images.First(z => z.Id == store.ImageId).StoreId = st.Id; db.SaveChanges(); return(st.Id); } }
public void ModifyStore_4() { int ExpectedOutput = -2; int GotOutput = -1; CRUDTemplate <IStores> StoresTemplateObj = new StoresTemplate(); Stores StoresObj = new Stores(); StoresObj.SetStoreID(7); StoresObj.SetStoreName(null); StoresObj.SetStoreLogo("images\\walmart_test.png"); try { GotOutput = StoresTemplateObj.Update(StoresObj); } catch (Exception) { GotOutput = -2; } Assert.AreEqual(ExpectedOutput, GotOutput); }
public ActionResult Edit(int id) { Stores store = null; using (var client = new HttpClient()) { client.BaseAddress = new Uri("https://localhost:44395/"); var responseTask = client.GetAsync("api/Stores/" + id); responseTask.Wait(); var result = responseTask.Result; if (result.IsSuccessStatusCode) { var readTask = result.Content.ReadAsAsync <Stores>(); readTask.Wait(); store = readTask.Result; } } return(View(store)); }
public IDataStoreObject <T> Get <T>() where T : IDataObject { var type = typeof(T); var storeExists = Stores.ContainsKey(typeof(T)); if (!storeExists) { Console.WriteLine("New {0} store", type.Name); var store = new JsonDataStoreObject <T>(HostingEnvironment); Stores.TryAdd(type, store); return(store); } else { Stores.TryGetValue(type, out object result); return((IDataStoreObject <T>)result); } }
public async Task DeleteStore(Store store) { if (IsBusy) { return; } IsBusy = true; try { await dataStore.RemoveStoreAsync(store); Stores.Remove(store); Sort(); } catch (Exception ex) { page.DisplayAlert("Uh Oh :(", "Unable to remove store, please try again", "OK"); Xamarin.Insights.Report(ex); } finally { IsBusy = false; } }
public async Task <IActionResult> Put(long id, [FromBody] Stores item) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { var store = _mapper.Map <Stores>(item); _context.Stores.Update(store); await _context.SaveChangesAsync(); return(Ok()); } catch { return(BadRequest()); } }
public ActionResult Create(Stores model) { try { int stateTransaction = SaveDataInt <Stores>("api/SuperZ/SaveStore", model); if (stateTransaction != -1) { return(RedirectToAction("Index")); } else { ModelState.AddModelError(string.Empty, "Duplicate row id."); } } catch { return(View()); } return(View()); }
private void GeneralReport_Load(object sender, EventArgs e) { Stores stor = new Stores(); DataTable dtStor = stor.GetActiveStores(); DataRow rowStore = dtStor.NewRow(); rowStore["ID"] = "0"; rowStore["StoreName"] = "All"; dtStor.Rows.InsertAt(rowStore, 0); cboStores.Properties.DataSource = dtStor; cboStores.ItemIndex = 0; dtDate.Value = DateTime.Now; dtDate.CustomFormat = "MM/dd/yyyy"; dtCurrent = ConvertDate.DateConverter(dtDate.Text); cboYear.Properties.DataSource = Items.AllYears(); cboYear.EditValue = dtCurrent.Year; GeneratCostChartForAllStores(); }
public static void CheckInToRemote(SiteDb SiteDb, string RemoteServerUrl, string RemoteServerUserName, string RemoteServerPassword, Guid RemoteWebSiteId) { var store = Stores.ClusterNodes(SiteDb); var LocalSelfRecord = store.Where(o => o.IsLocal && o.ServerWebSiteId == SiteDb.WebSite.Id).FirstOrDefault(); if (LocalSelfRecord == null) { return; } ClusterNode node = new ClusterNode(); node.ServerUrl = LocalSelfRecord.ServerUrl; node.ServerWebSiteId = SiteDb.WebSite.Id; node.UserName = LocalSelfRecord.UserName; node.Password = LocalSelfRecord.Password; CheckInToRemote(SiteDb, RemoteServerUrl, RemoteServerUserName, RemoteServerPassword, RemoteWebSiteId, node); }
public override async Task LoadAsync() { if (Stores.Count == 0) { Stores.Add(new Store() { Id = "1", Description = "Descrição da Loja X", Name = "Loja X" }); Stores.Add(new Store() { Id = "2", Description = "Descrição da Loja Z", Name = "Loja Z" }); Stores.Add(new Store() { Id = "2", Description = "Descrição da Loja Y", Name = "Loja Y" }); OnPropertyChanged(nameof(Stores)); } }
public void Insert() { using (MashadCarpetEntities db = new MashadCarpetEntities()) { Stores n = new Stores(); n.StoreID = Guid.NewGuid(); n.IsDelete = false; // n.StoreName = txtName.Text; n.StorePhone = txtPhone.Text; n.StoreCity = txtCity.Text; n.StoreAddress = txtAddress.Text; n.IsStore = true; // n.Prov = txtPov.Text; // n.StoreDesc = txtDesc.Text; db.Stores.Add(n); db.SaveChanges(); } Loadgrd(); mvStores.SetActiveView(vwlist); }
public Posts_ByTitleAndContent() { Map = posts => from post in posts select new { post.Title, post.Desc }; Stores.Add(x => x.Title, FieldStorage.Yes); Stores.Add(x => x.Desc, FieldStorage.Yes); #if !DNXCORE50 Analyzers.Add(x => x.Title, typeof(SimpleAnalyzer).FullName); Analyzers.Add(x => x.Desc, typeof(SimpleAnalyzer).FullName); #else Analyzers.Add(x => x.Title, "Lucene.Net.Analysis.SimpleAnalyzer"); Analyzers.Add(x => x.Desc, "Lucene.Net.Analysis.SimpleAnalyzer"); #endif }
private async Task ExecuteGetStoresCommand() { if (IsBusy) { return; } if (ForceSync) { Settings.LastSync = DateTime.Now.AddDays(-30); } IsBusy = true; GetStoresCommand.ChangeCanExecute(); try{ Stores.Clear(); var stores = await dataStore.GetStoresAsync(); foreach (var store in stores) { if (string.IsNullOrWhiteSpace(store.Image)) { store.Image = "http://refractored.com/images/wc_small.jpg"; } Stores.Add(store); } Sort(); } catch (Exception ex) { await page.DisplayAlert("Uh Oh :(", "Unable to gather stores.", "OK"); Xamarin.Insights.Report(ex); } finally { IsBusy = false; GetStoresCommand.ChangeCanExecute(); } }
public static List <Stores> GetAllStores() { List <Stores> allStores = new List <Stores>(); SqlConnection connection = Connection.GetConnection(); String query = "SELECT * FROM Stores"; SqlCommand cmd = new SqlCommand(query, connection); try { connection.Open(); SqlDataReader read = cmd.ExecuteReader(); while (read.Read()) { Stores st = new Stores(); st.StoreID = (String)read["storeNum"]; st.StoreAddress = (String)read["storeAddress"]; st.StoreCity = (String)read["storeCity"]; st.StoreState = (String)read["storeState"]; st.StoreZip = (String)read["storeZip"]; st.StoreManager = (String)read["storeManager"]; allStores.Add(st); } } catch (SqlException ex) { } catch (Exception ex) { } finally { connection.Close(); } return(allStores); }
static void Main(string[] args) { IApplication app = new Applications(); Console.WriteLine("To add a customer press 1: "); string input = Console.ReadLine(); if (input == "1") { Console.WriteLine("Please enter customer name: "); string name = Console.ReadLine(); app.AddCustomer(new Customers(name)); } app.AddCustomer(new Customers("Jim")); Console.WriteLine(); //Customer logic test //Console.WriteLine(c.ViewCustomer()); //Console.WriteLine(c1.ViewCustomer()); //Store logic test Stores s1 = new Stores("Sears", 101, "Nevada"); Console.WriteLine(s1.ViewStore()); //creating products to gather for stores ?????? Products p1 = new Products("Toy", false, "Nevada"); Console.WriteLine(p1.HasProduct()); //Products p2 = new Products("Game", true, "Texas"); //Products p3 = new Products("Food", true, "Florida"); //Products p4 = new Products("Bike", false, "Arizona"); //Console.WriteLine(p1.ViewProduct()); }
private void GeneralReport_Load(object sender, EventArgs e) { var type = new BLL.Type(); DataTable alltypes = type.GetAllCategory(); DataRow row = alltypes.NewRow(); row["ID"] = "0"; row["Name"] = "All"; alltypes.Rows.InsertAt(row, 0); lkCategory.Properties.DataSource = alltypes; lkCategory.Properties.DisplayMember = "Name"; lkCategory.Properties.ValueMember = "ID"; lkCategory.ItemIndex = 0; Stores stor = new Stores(); stor.GetActiveStores(); DataTable dtStor = stor.DefaultView.ToTable(); DataRow rowStore = dtStor.NewRow(); rowStore["ID"] = "0"; rowStore["StoreName"] = "All"; dtStor.Rows.InsertAt(rowStore, 0); cboStores.Properties.DataSource = dtStor; cboStores.ItemIndex = 0; dtDate.Value = DateTime.Now; dtDate.CustomFormat = "MM/dd/yyyy"; dtCurrent = ConvertDate.DateConverter(dtDate.Text); curMont = dtCurrent.Month; curYear = dtCurrent.Year; dtDate.Value = DateTime.Now; dtDate.CustomFormat = "MM/dd/yyyy"; _dtCur = ConvertDate.DateConverter(dtDate.Text); cboYear.Properties.DataSource = Items.AllYears(); cboYear.EditValue = curYear; }
async public Task LoadStores() { if (IsStoresLoading) { return; } IsStoresLoading = true; HasStors = null; var options = new EtaApiQueryStringParameterOptions(); options.AddParm(EtaApiConstants.EtaApi_Latitude, UserViewModel.Location.Latitude.ToString("0.00000")); options.AddParm(EtaApiConstants.EtaApi_Longitude, UserViewModel.Location.Longitude.ToString("0.00000")); options.AddParm(EtaApiConstants.EtaApi_LocationDetermined, UNIXTime.GetTimestamp(DateTime.Now)); options.AddParm(EtaApiConstants.EtaApi_Geocoded, UserViewModel.Location.IsGeoCoded ? "1" : "1"); options.AddParm(EtaApiConstants.EtaApi_Ditance, UserViewModel.Distance.ToString()); var response = await Api.GetStoreListAsync(options); Deployment.Current.Dispatcher.BeginInvoke(() => { if (Stores.Any()) { Stores.Clear(); } if (response.HasErrors) { IsStoresLoaded = false; } else { foreach (var store in response.Result) { Stores.Add(store); } IsStoresLoaded = true; } HasStors = Stores.Any(); IsStoresLoading = false; }); }
//-------------------------------------------------------------------------------- private void ShowGrid() { try { Stores m_Stores = new Stores(); m_Stores.StoreName = txtSearch.Text; string DateFrom = txtDateFrom.Text; string DateTo = txtDateTo.Text; int RowCount = 0; List <Stores> l_Stores = m_Stores.GetPage("", "", ddlOrderBy.SelectedValue, m_grid.PageSize, CustomPaging.PageIndex - 1, ref RowCount); m_grid.DataSource = l_Stores; m_grid.DataBind(); lblTong.Text = RowCount.ToString(); CustomPaging.TotalPage = (RowCount == 0) ? 1 : (RowCount % m_grid.PageSize == 0) ? RowCount / m_grid.PageSize : (RowCount - RowCount % m_grid.PageSize) / m_grid.PageSize + 1; } catch (Exception ex) { sms.utils.Log.writeLog(ex.ToString(), ((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name); } }
public ReduceIndex() { Map = users => from user in users select new { user.Age, user.Name, Count = 1 }; Reduce = results => from result in results group result by new { result.Age, result.Name } into g select new { Age = g.Key.Age, Name = g.Key.Name, Count = g.Sum(x => x.Count) }; Stores.Add(x => x.Age, FieldStorage.Yes); Stores.Add(x => x.Count, FieldStorage.Yes); }
// GET: Stores/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Stores stores = db.stores.Find(id); if (stores == null) { return(HttpNotFound()); } var geoCoder = new MapQuestAPI("gKTipZ5WZaojeUSPTQfy7YT2JAjL6Mm3"); var latLong = geoCoder.GetLatLng(stores.Location); TempData["Lat"] = (float)latLong.lat; TempData["Lng"] = (float)latLong.lng; return(View(stores)); }
public ActionResult Create([Bind(Include = "Id,CompanyId,Name,Adress,City,Zip,Country,Longitude,Latitude")] Stores stores) { if (ModelState.IsValid) { db.Stores.Add(stores); try { db.SaveChanges(); } catch (DbEntityValidationException e) { Console.WriteLine(e); throw; } return(RedirectToAction("Index")); } ViewBag.CompanyId = new SelectList(db.Companies, "Id", "Name", stores.CompanyId); return(View(stores)); }
public Stores Create(Stores stores, Users users) { if (_context.Stores.Any(x => x.Name == stores.Name)) { throw new AppException("Store Name \"" + stores.Name + "\" is already taken"); } if (!_context.CityMasters.Any(x => x.Id == stores.CityId)) { throw new AppException("City Id \"" + stores.CityId + "\" is not valid"); } stores.CreatedDate = DateTime.UtcNow; stores.UpdatedDate = DateTime.UtcNow; stores.ApplicationId = users.ApplicationId; _context.Stores.Add(stores); _context.SaveChanges(); return(stores); }
public void AddStore(object a) { if (Address == "" || Place == "" || Capacity <= 0 || Staff <= 0) { MessageBox.Show("Vul geldige gegevens in"); return; } else { Stores store = new Stores() { Address = Address, Place = Place, Capacity = Capacity, Staff = Staff }; db.Stores.Add(store); db.SaveChanges(); MessageBox.Show("Store is toegevoegd"); }; }
/// <summary> /// Remove the default values that we don't actually need /// </summary> public void RemoveDefaultValues() { var defaultStorage = IsMapReduce ? FieldStorage.Yes : FieldStorage.No; foreach (var toRemove in Stores.Where(x => x.Value == defaultStorage).ToArray()) { Stores.Remove(toRemove); } foreach (var toRemove in Indexes.Where(x => x.Value == FieldIndexing.Default).ToArray()) { Indexes.Remove(toRemove); } foreach (var toRemove in SortOptions.Where(x => x.Value == Indexing.SortOptions.None).ToArray()) { SortOptions.Remove(toRemove); } foreach (var toRemove in Analyzers.Where(x => string.IsNullOrEmpty(x.Value)).ToArray()) { Analyzers.Remove(toRemove); } }