public Shops GetSingleShops(int id) { string sql = "P_GetSingleShop"; SqlParameter[] para = { new SqlParameter("@S_ID", id) }; DataTable dt = DBHelper.ExecuteSelect(sql, true, para); DataRow dr = dt.Rows[0]; Model.Shops s = new Shops(); s.S_ID = (int)dr["S_ID"]; s.S_Name = (string)dr["S_Name"]; s.S_ContactName = (string)dr["S_ContactName"]; s.S_ContactTel = (string)dr["S_ContactTel"]; s.S_Address = (string)dr["S_Address"]; s.S_Category = (int)dr["S_Category"]; s.S_CreateTime = (DateTime)dr["S_CreateTime"]; s.S_IsHasSetAdmin = (bool)dr["S_IsHasSetAdmin"]; if (dr["S_Remark"] != DBNull.Value) { s.S_Remark = (string)dr["S_Remark"]; } return(s); }
public ActionResult UpdateShop(string ShopName, string Category, string TellName, string Phone, string Address, string Remark, string ID) { using (UPMSEntities db = new UPMSEntities()) { Shops shop = new Shops(); { shop.S_ID = Convert.ToInt32(ID); shop.S_Name = ShopName; shop.S_Category = Convert.ToInt32(Category); shop.S_ContactName = TellName; shop.S_ContactTel = Phone; shop.S_Address = Address; shop.S_Remark = Remark; } db.Entry <Shops>(shop).State = EntityState.Modified; int result = db.SaveChanges(); paramModel <object> param = new paramModel <object>(); if (result > 0) { param.status = 1; param.msg = "修改成功!"; } else { param.status = 0; param.msg = "修改失败!"; } return(Json(param, JsonRequestBehavior.AllowGet)); } }
public async Task <IActionResult> Edit(string id, [Bind("ShopRef,Shopname,Address1,Address2,Address3,Address4,PostCode,ContactName,Telephone,Telephone2,Fax,Email,Memo,SHopType")] Shops shops) { if (id != shops.ShopRef) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(shops); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ShopsExists(shops.ShopRef)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(shops)); }
/// <summary> /// 店数変更処理されたときに通知を受け取る。 /// </summary> /// <param name="sender">送信元オブジェクト</param> /// <param name="e">イベントオブジェクト</param> private void OnButtonChangeShopCountClick(object sender, EventArgs e) { FormNumberInput form = new FormNumberInput(); form.Number = Shops.Count - 1; if (form.ShowDialog(this) != DialogResult.OK) { return; } int newCount = form.Number + 1; if (newCount >= Shops.Count) { while (Shops.Count < newCount) { int id = Shops.Count; Shops.Add(new DataShop() { Id = id }); } } else if (newCount < Shops.Count) { while (Shops.Count > newCount) { Shops.RemoveAt(Shops.Count - 1); } } ModelToUI(); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,BaseUrl,LastSyncOrderId,LastSync,LastSyncProdId")] Shops shops) { if (id != shops.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(shops); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ShopsExists(shops.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(shops)); }
private void ReorderShopList() { var list = new ObservableCollection <Shop>(Shops.OrderByDescending(item => item.Id)); Shops = list; Shops.CollectionChanged += OnListChanged; }
public async Task DeleteAsync(SimpleUser user, Shops shops, CancellationToken cancellationToken = default(CancellationToken)) { if (user == null) { throw new ArgumentNullException(nameof(user)); } if (shops == null) { throw new ArgumentNullException(nameof(shops)); } shops.DeleteTime = DateTime.Now; shops.DeleteUser = user.Id; shops.IsDeleted = true; Context.Attach(shops); var entry = Context.Entry(shops); entry.Property(x => x.IsDeleted).IsModified = true; entry.Property(x => x.DeleteUser).IsModified = true; entry.Property(x => x.DeleteTime).IsModified = true; try { await Context.SaveChangesAsync(cancellationToken); } catch (DbUpdateConcurrencyException) { throw; } }
public ActionResult AddShop(string ShopName, string Category, string TellName, string Phone, string Address, string Remark) { using (UPMSEntities db = new UPMSEntities()) { Shops shop = new Shops(); shop.S_Category = Convert.ToInt32(Category); shop.S_Name = ShopName; shop.S_ContactName = TellName; shop.S_ContactTel = Phone; shop.S_Address = Address; shop.S_Remark = Remark; shop.S_CreateTime = DateTime.Now; db.Shops.Add(shop); int len = db.SaveChanges(); paramModel <int> result = new paramModel <int>(); if (len > 0) { result.status = 1; result.msg = "添加成功!"; } else { result.status = 0; result.msg = "添加失败!"; } return(Json(result, JsonRequestBehavior.AllowGet)); } }
public ActionResult Shops(Shops model) { User currentUser = SecurityHelper.GetCurrentUser().CurrentUser; model.Ready((AdminUser)currentUser); return(View("Shops", model)); }
public async Task <IActionResult> PutShops(int id, Shops shops) { if (id != shops.Id) { return(BadRequest()); } _context.Entry(shops).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ShopsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void AddQuickTest() { VerifyDoesntExist(); bool value = Shops.Add(_databasePath, _shopsName, out _errOut); General.HasTrueValue(value, _errOut); }
/// <summary> /// Verifies the exists. /// </summary> private void VerifyExists() { if (!Shops.Exists(_databasePath, _shopsName, out _errOut)) { bool value = Shops.Add(_databasePath, _shopsName, out _errOut); } }
public void ExistsTest() { VerifyExists(); bool value = Shops.Exists(_databasePath, _shopsName, out _errOut); General.HasTrueValue(value, _errOut); }
public void GetTest() { List <GunShopDetails> value = Shops.Get(_databasePath, out _errOut); PrintList(value); General.HasTrueValue(value.Count > 0, _errOut); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Address,OwnersID")] Shops shops) { if (id != shops.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(shops); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ShopsExists(shops.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["OwnersID"] = new SelectList(_context.Owners, "ID", "Name", shops.Owners.Name); return(View(shops)); }
public void Seed(Model model) { if (model.Categories != null) { Categories.AddRange(model.Categories); } if (model.Products != null) { Products.AddRange(model.Products); } if (model.Regions != null) { Regions.AddRange(model.Regions); } if (model.Shops != null) { Shops.AddRange(model.Shops); } if (model.Customers != null) { Customers.AddRange(model.Customers); } if (model.Campaigns != null) { Campaigns.AddRange(model.Campaigns); } if (model.Sales != null) { Sales.AddRange(model.Sales); } if (model.LeadStates != null) { LeadStates.AddRange(model.LeadStates); } if (model.LeadHistory != null) { LeadHistory.AddRange(model.LeadHistory); } if (model.Budget != null) { Budget.AddRange(model.Budget); } if (model.RegionWiseSales != null) { RegionWiseSales.AddRange(model.RegionWiseSales); } if (model.Opportunities != null) { Opportunities.AddRange(model.Opportunities); } if (model.ProfitAndSales != null) { ProfitAndSales.AddRange(model.ProfitAndSales); } if (model.RegionSales != null) { RegionSales.AddRange(model.RegionSales); } SaveChanges(); }
public async Task <ActionResult <Shops> > PostShop() { var shop = new Shops(); shop.name = HttpContext.Request.Form["name"]; shop.CitiesId = int.Parse(HttpContext.Request.Form["CityId"]); var shopExist = _context.Shops.Where(s => s.name.ToLower() == shop.name.ToLower() && s.CitiesId == shop.CitiesId && s.isDeleted == false).FirstOrDefault(); if (shopExist != null) { return(StatusCode(418)); } shop.info = HttpContext.Request.Form["info"]; // shop.status = int.Parse(HttpContext.Request.Form["status"]); shop.permalink = HttpContext.Request.Form["permalink"]; shop.time_open = DateTime.Parse(HttpContext.Request.Form["time_open"]); shop.time_close = DateTime.Parse(HttpContext.Request.Form["time_close"]); var user = HttpContext.Session.GetObjectFromJson <Users>("user"); shop.created_by = user.username; _context.Shops.Add(shop); await _context.SaveChangesAsync(); var httpPostedFile = HttpContext.Request.Form.Files["avatarFile"]; shop.images = _uploadImage.upload(_hostingEnvironment, httpPostedFile, "shops", shop.id); await _context.SaveChangesAsync(); // var shops = GetAllShops(); return(CreatedAtAction("GetShop", new { id = shop.id }, new { shop.id, shop.images })); }
public ActionResult AddAdoptSucculentList(int ActID = 1) { try { if (Session["UserName"].ToString() != "") { Users user = usermanager.GetUserByName(Session["UserName"].ToString()); Activity act = activitymanager.GetActivity(ActID); if (user.UserFlag == 1 && act.UserID == user.UserID) { Shops shop = shopmanager.GetShopByUserID(user.UserID); AdoptListAddVM adoptadd = new AdoptListAddVM(); adoptadd.Activity = act; adoptadd.Shops = shop; adoptadd.Goods = goodsmanager.SelectShopDuorouZhiwu(shop.ShopID); return(View(adoptadd)); } else { return(Content("<script>alert('抱歉,您权限不足!');history.go(-1);</script>")); } } else { return(Content("<script>alert('请先登录');window.location='" + Url.Action("Login", "User") + "'</script>")); } } catch (Exception ex) { string error = ex.Message; return(Content("<script>alert('系统出错');window.location='" + Url.Action("Login", "User") + "'</script>")); } }
public NewClient(Client client, Shops curShop, string phone) { InitializeComponent(); newClient = client; shop = curShop; mtxbxPhone.Text = phone; }
public static void WriteSettingsToRegistry(Shops currentShop, string clientsDBPath, string serverDBPath) { try { RegistryKey rk = null; try { rk = Registry.CurrentUser.CreateSubKey(regKeyName); if (rk == null) { return; } rk.SetValue("CurrentShop", currentShop); rk.SetValue("ClientsFolder", clientsDBPath); rk.SetValue("ServerFolder", serverDBPath); } catch (Exception) { } finally { if (rk != null) { rk.Close(); } } } catch (Exception) { return; } }
public static Shops ReadSettingsFromRegistry() { Shops shopToWork = Shops.Bars; RegistryKey rk = null; try { rk = Registry.CurrentUser.OpenSubKey(regKeyName); if (rk == null) { return(shopToWork); } shopToWork = (Shops)Shops.Parse(typeof(Shops), (string)rk.GetValue("CurrentShop")); } catch (Exception) { } finally { if (rk != null) { rk.Close(); } } return(shopToWork); }
public JsonResult DeleteConfirmed(int id) { try { Shops shops = db.Shops.Find(id); List <Products> lProducts = db.Products.Where(s => s.ShopId == id).ToList(); foreach (Products Product in lProducts) { db.Products.Remove(Product); db.SaveChanges(); } db.Shops.Remove(shops); db.SaveChanges(); var lResult = db.Shops.Select(s => new { s.ShopId, s.Shop_adress, s.Shop_name, s.Shop_time }).ToList(); return(Json(lResult, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(null); } }
public ActionResult Shop(int?pageIndex) { var goodIds = ShopingServices.LoadEntities(s => s.UserInfoId == CurrentLoginUser.Id && s.DelFlag == normal); if (pageIndex == null || pageIndex <= 0) { pageIndex = 1; } List <Shops> list = new List <Shops>(); int total = 0; if (goodIds != null) { foreach (var item in goodIds) { Shops shop = new Shops(); int goodid = item.GoodsId; Goods good = GoodsServices.LoadPageEntities((int)pageIndex, 5, out total, u => u.Id == goodid , u => u.Id, true).FirstOrDefault(); shop.ShopId = item.Id; shop.Goods = good; list.Add(shop); } } ViewData["allGoods"] = list; ViewData["pageIndex"] = pageIndex; ViewData["Count"] = total; return(View()); }
static async Task Main(string[] args) { SqlHelper sqlHelper = new SqlHelper(); var data = await sqlHelper.Find <Products>(Guid.Parse("C27DB4DF-E208-4E6F-B416-D0F475FF9051")); var data1 = await sqlHelper.Find <Shops>(Guid.Parse("C27DB4DF-E208-4E6F-B416-698743FF9051")); bool result = await sqlHelper.Insert <ShopType>(new ShopType { Name = "类型1", Remarks = "无备注", Date = DateTime.Now }); Shops shops = await sqlHelper.Find <Shops>(Guid.Parse("C27DB4DF-E208-4E6F-B416-698743FF9051")); shops.ShopName = "商铺1"; var datas = sqlHelper.Update <Shops>(shops); //var data = await sqlHelper.Delete<Shops>(new List<Shops> //{ // new Shops{ Id=Guid.Parse("c27db4df-e208-4e6f-b416-698743ff9053")}, // new Shops{ Id=Guid.Parse("c27db4df-e208-4e6f-b416-698743ff9055")} //}); // var data = await sqlHelper.Delete<Shops>(Guid.Parse("C27DB4DF-E208-4E6F-B416-698743FF9059")); Console.ReadKey(); Console.WriteLine("Hello World!"); }
// [ValidateAntiForgeryToken] public async Task <IActionResult> Edit(int id, [Bind("ShopId,ShopName,PhoneNumber,WebsiteUrl,City")] Shops shops) { if (id != shops.ShopId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(shops); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ShopsExists(shops.ShopId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(shops)); }
/// <summary> /// Replaces an old <c>Shop</c>-Object with a modified one. /// </summary> /// <param name="oldShop">The <c>Shop</c>-Object that should be replaced.</param> /// <param name="newShop">The <c>Shop</c>-Object that should be inserted into the Collection.</param> public void EditShop(Shop oldShop, Shop newShop) { // Get index of old object int idx = Shops.IndexOf(oldShop); // Clone ShoppingLists-List var templist = ShoppingLists.ToList(); // Query all shopping lists and update the Shop object of the Shopping lists foreach (ShoppingList list in templist) { if (list.Shop.ID.Equals(oldShop.ID)) { // Get index of old object int listIdx = ShoppingLists.IndexOf(list); // Set new shop list.Shop = newShop; // Remove old object from list and insert new one ShoppingLists.RemoveAt(listIdx); ShoppingLists.Insert(listIdx, list); } } // Remove old object and insert new object at the same position as the old one Shops.Remove(oldShop); Shops.Insert(idx, newShop); // Save data to isolated storage SaveShops(); SaveShoppingLists(); // Replace old Geofence with new one ServiceLocator.Current.GetInstance <GeoHelper>().ModifyGeofence(oldShop.ID, newShop); }
public ActionResult CreateShopInfo(Shops s) { try { //获取数据 s.S_Name = Request.Form["S_Name"]; s.S_Category = int.Parse(Request.Form["S_Category"]); s.S_ContactName = Request.Form["S_ContactName"]; s.S_ContactTel = Request.Form["S_ContactTel"]; s.S_Address = Request.Form["S_Address"]; s.S_Remark = Request.Form["S_Remark"]; s.S_CreateTime = DateTime.Now; //加盟时间 s.S_IsHasSetAdmin = false; //默认无管理员 //添加数据 db.Shops.InsertOnSubmit(s); //保存修改 db.SubmitChanges(); return(Content("OK")); } catch { return(View()); } }
protected override void Seed(BDConect db) { Shops newShops = new Shops() { Name = "Rozetka" }; Categories newCategories = new Categories() { Name = "notebooks", Shops = newShops }; CategoriesPath newCategoriesPath = new CategoriesPath() { Categories = newCategories, PathToCategory = "https://rozetka.com.ua/|https://rozetka.com.ua/computers-notebooks/|https://rozetka.com.ua/notebooks/" }; Categories newCategories1 = new Categories() { Name = "mobile-phones", Shops = newShops }; CategoriesPath newCategoriesPath1 = new CategoriesPath() { Categories = newCategories1, PathToCategory = "https://rozetka.com.ua/|https://rozetka.com.ua/telefony-tv-i-ehlektronika/|https://rozetka.com.ua/telefony/|https://rozetka.com.ua/mobile-phones/" }; db.Shops.Add(newShops); db.Categories.Add(newCategories); db.CategoriesPath.Add(newCategoriesPath); db.Categories.Add(newCategories1); db.CategoriesPath.Add(newCategoriesPath1); base.Seed(db); }
private void Add_Click(object sender, EventArgs e) { if (tbName.Text.Length > 0) { // Create a new to-do item. Shops newShopsItem = new Shops { ShopName = tbName.Text, ShopAdres = tbAdress.Text, ShopCity = tbCity.Text, ShopCountry = (Country)Enum.Parse(typeof(Country), lpkCountry.SelectedItem.ToString(), true), ShopGpsLocalization = (place.position.ToString() ?? String.Empty), ShopCategories = (place.category.ToString() ?? String.Empty) }; // Add the item to the ViewModel. App.ViewModel.AddShopsItem(newShopsItem); // Return to the main page. if (NavigationService.CanGoBack) { NavigationService.GoBack(); } } else { MessageBox.Show("Proszę wpisać nazwę sklepu!"); } }
//clears all the ticked boxes private void Clear_all_Click(object sender, EventArgs e) { if (Weeks.SelectionMode != SelectionMode.None) { Weeks.ClearSelected(); } All_dates.Checked = false; if (Provider.SelectionMode != SelectionMode.None) { Provider.ClearSelected(); } All_providers.Checked = false; if (Provider_type.SelectionMode != SelectionMode.None) { Provider_type.ClearSelected(); } All_Provider_types.Checked = false; if (Shops.SelectionMode != SelectionMode.None) { Shops.ClearSelected(); } All_shops.Checked = false; }
public StoreInventory( Context context, Shops whichStore, IList<byte> bytes ) { WhichStore = whichStore; ourContext = context; itemsList = context == Context.US_PSP ? Item.PSPDummies.Sub( 0, 255 ) : Item.PSXDummies; for ( int i = 0; i < 256; i++ ) { UInt16 currentShort = (UInt16)( bytes[i * 2] * 256 + bytes[i * 2 + 1] ); items[itemsList[i]] = ( currentShort & (int)whichStore ) > 0; } name = context == Context.US_PSP ? PSPResources.ShopNames[whichStore] : PSXResources.ShopNames[whichStore]; }
public void RemoveFromInventory( Shops shop, Item i ) { foreach ( var s in shops ) { if ( ( shop & s ) == s ) { StoresDict[s][i.Offset] = false; } } }
public StoreInventory( Context context, Shops whichStore, IList<byte> bytes, IList<byte> defaultBytes ) : this( context, whichStore, bytes ) { Default = new StoreInventory( context, whichStore, defaultBytes ); }
public void AddToInventory( Shops shop, Item i ) { foreach ( var s in shops ) { if ( ( shop & s ) == s ) { StoresDict[s][i.Offset] = true; } } }
public static void SendSaveShop(int shopNum, Shops.Shop shop) { TcpPacket packet = new TcpPacket("saveshop"); packet.AppendParameters( shopNum.ToString(), shop.Name, shop.JoinSay, shop.LeaveSay); for (int i = 0; i < MaxInfo.MAX_TRADES; i++) { packet.AppendParameters(shop.Items[i].GiveItem, shop.Items[i].GiveValue, shop.Items[i].GetItem); } packet.FinalizePacket(); SendPacket(packet); }