// GET: JewelryTypes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(RedirectToAction("Index", "Home")); } JewelryType jewelryType = db.JewelryTypes.Find(id); ViewBag.CompanyId = jewelryType.CompanyId; if (jewelryType == null) { return(HttpNotFound()); } DeleteJewelryTypeModel djtm = new DeleteJewelryTypeModel() { item = jewelryType }; if (db.Styles.Where(s => s.JewelryTypeId == id).Count() != 0) { List <Style> styles = db.Styles.Where(s => s.JewelryTypeId == id).ToList(); djtm.styles = styles.Distinct(new StyleEqualityComparer()).ToList(); djtm.bError = true; } return(View(djtm)); }
public void NewOrder() { int end = GetEndWork(); Order order = new Order(SomeMaster, SomeJewelry, Today.AddDays(SomeMaster.Busy + 1), Today.AddDays(end + SomeMaster.Busy), "Заказ обрабатывается"); for (int i = 0; i < Clients.Count; ++i) { if (Clients[i].Equals(Client)) { Clients[i].Orders.Add(order); Clients[i].Basket.Remove(SomeJewelry); JewelryType.Remove(SomeJewelry); } } for (int i = 0; i < Masters.Count; ++i) { if (Masters[i].Equals(SomeMaster)) { Masters[i].Busy += end; } } GetOrders(); SaveChanges(); }
public ActionResult Edit(ProductDetailModel data, FormCollection dat) { JewelryCategory category = new JewelryCategory(); category.Id = Convert.ToInt32(dat["Category"]); JewelryColor color = new JewelryColor(); color.Id = Convert.ToInt32(dat["color"]); JewelryType type = new JewelryType(); type.Id = Convert.ToInt32(dat["Type"]); JewelryImages images = new JewelryImages(); //images.Id = Convert.ToInt32(data.ImageUrl); Jewelry jewelry = new Jewelry { Id = data.Id, Name = data.Name, Description = data.Description, Price = data.Price, Category = new JewelryCategory { Id = category.Id }, Color = new JewelryColor { Id = color.Id }, Type = new JewelryType { Id = type.Id }, }; new JewelryHandler().update(jewelry); return(RedirectToAction("home", "admin")); }
public ActionResult DeleteConfirmed(int id) { JewelryType jewelryType = db.JewelryTypes.Find(id); db.JewelryTypes.Remove(jewelryType); db.SaveChanges(); return(RedirectToAction("Index")); }
public void GetAllJewelry() { JewelryType.Clear(); foreach (Jewelry j in AllJewelries) { JewelryType.Add(j); } }
public void ShowBasket() { JewelryType.Clear(); foreach (Jewelry j in Client.Basket) { JewelryType.Add(j); } }
public void GetPendant() { JewelryType.Clear(); foreach (Jewelry j in Pendants) { JewelryType.Add(j); } }
public void ShowCatalog() { JewelryType.Clear(); foreach (Jewelry j in Jewelries) { JewelryType.Add(j); } }
public void GetEarrings() { JewelryType.Clear(); foreach (Jewelry j in Earrings) { JewelryType.Add(j); } }
public void GetBrand(string brand) { Jewelry[] selection = JewelryType.Where(i => i.Brand == brand).ToArray <Jewelry>(); JewelryType.Clear(); foreach (Jewelry j in selection) { JewelryType.Add(j); } }
public void GetKernel(string kernel) { Jewelry[] selection = JewelryType.Where(i => i.Kernel.Material.Name == kernel).ToArray <Jewelry>(); JewelryType.Clear(); foreach (Jewelry j in selection) { JewelryType.Add(j); } }
public void GetCombine() { Jewelry[] selection = JewelryType.Where(i => i.Basis.Material.Name == "комбинированный").ToArray <Jewelry>(); JewelryType.Clear(); foreach (Jewelry j in selection) { JewelryType.Add(j); } }
public void GetGold() { Jewelry[] selection = JewelryType.Where(i => i.Basis.Material.Name == "золото").ToArray <Jewelry>(); JewelryType.Clear(); foreach (Jewelry j in selection) { JewelryType.Add(j); } }
public void RemoveJewelry() { Jewelries.Remove(SomeJewelry); GetCollections(); if ((JewelryType.Count > 0 && SomeJewelry.Type.NameOfJewerly == JewelryType[0].Type.NameOfJewerly) || JewelryType.Equals(Jewelries)) { JewelryType.Remove(SomeJewelry); } }
public PiercingJewelry(JewelryType jewelryType, JewelryMaterial jewelryMaterial, bool canRemove) { removable = canRemove; this.jewelryMaterial = jewelryMaterial ?? throw new ArgumentNullException(nameof(jewelryMaterial)); if (!Enum.IsDefined(typeof(JewelryType), jewelryType)) { throw new ArgumentException("A single piece of piercing jewelry can only have one, valid jewelry type."); } this.jewelryType = jewelryType; }
public ActionResult Edit([Bind(Include = "JewelryTypeId,JewelryTypeName")] JewelryType jewelryType) { if (ModelState.IsValid) { db.Entry(jewelryType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(jewelryType)); }
public ActionResult Create([Bind(Include = "JewelryTypeId,JewelryTypeName")] JewelryType jewelryType) { if (ModelState.IsValid) { db.JewelryTypes.Add(jewelryType); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(jewelryType)); }
public void RemoveJewelryFromBasket() { for (int i = 0; i < Client.Basket.Count; ++i) { if (Client.Basket[i] == SomeJewelry) { Client.Basket.RemoveAt(i); JewelryType.Remove(SomeJewelry); break; } } }
public static async Task <IEnumerable <JewelryDataGroup> > GetGroupByType(JewelryType jewelryType) { await _jewelryDataSource.GetDataAsync(); var matches = _jewelryDataSource.Groups.Where((group) => group.Type.Equals(jewelryType)); if (matches.Count() > 0) { return(matches); } return(null); }
public string GetJewelryType(int id) { JewelryType jewelryType = db.JewelryTypes.Find(id); if (jewelryType == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } CostData cd = new CostData(); cd.companyId = jewelryType.CompanyId.Value; // two dictionaries, one for each market & multiplier Dictionary <string, decimal> metalMarketPrice = new Dictionary <string, decimal>(); // one for each metal type Dictionary <string, float> metalMultiplier = new Dictionary <string, float>(); // one for each metal type // assign market and multiplier for each metalcode // Metal Costs foreach (MetalCode m in db.MetalCodes.Where(x => x.CompanyId == jewelryType.CompanyId)) // add company ID!!! { // Metal Market Price if (cd.metalMarketPrice.Where(k => k.Key == m.Code).Count() == 0) { cd.metalMarketPrice.Add(m.Code, m.Market); } // Metal Multiplier if (cd.metalMultiplier.Where(k => k.Key == m.Code).Count() == 0) { cd.metalMultiplier.Add(m.Code, m.Multiplier); } } //if (!jewelryType.bUseLaborTable) { // Finishing and Packaging Costs foreach (JewelryType j in db.JewelryTypes.Where(x => x.CompanyId == jewelryType.CompanyId)) { // Finishing Costs: per Jewelry Type if (cd.finishingCosts.Where(k => k.Key == j.Name).Count() == 0) { cd.finishingCosts.Add(j.Name, j.FinishingCost); } // Packaging Costs: per Jewelry Type if (cd.packagingCosts.Where(k => k.Key == j.Name).Count() == 0) { cd.packagingCosts.Add(j.Name, j.PackagingCost); } } } JewelryTypeJSON jt = new JewelryTypeJSON(jewelryType, cd); string json = JsonConvert.SerializeObject(jt); return(json); }
public ActionResult Edit([Bind(Include = "Id,Name,PackagingCost,FinishingCost,CompanyId,bUseLaborTable")] JewelryType jewelryType) { if (ModelState.IsValid) { db.Entry(jewelryType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", new { companyId = jewelryType.CompanyId })); } ViewBag.CompanyId = jewelryType.CompanyId; ViewBag.CompanyName = db._Companies.Find(jewelryType.CompanyId)?.Name; ViewBag.CompanyHasLTIs = db.LaborTable.Where(lti => lti.CompanyId == jewelryType.CompanyId).Count() == 0; return(View(jewelryType)); }
// GET: JewelryTypes/Details/5 public ActionResult Details(int?id) { if (id == null) { return(RedirectToAction("Index", "Home")); } JewelryType jewelryType = db.JewelryTypes.Find(id); if (jewelryType == null) { return(HttpNotFound()); } return(View(jewelryType)); }
// GET: JewelryTypes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } JewelryType jewelryType = db.JewelryTypes.Find(id); if (jewelryType == null) { return(HttpNotFound()); } return(View(jewelryType)); }
public void RedactJewelry() { Jewelry jewelry = new Jewelry(); jewelry = SomeJewelry; RemoveJewelry(); Jewelries.Add(jewelry); GetCollections(); if ((JewelryType.Count > 0 && jewelry.Type.NameOfJewerly == JewelryType[0].Type.NameOfJewerly) || JewelryType.Equals(Jewelries)) { JewelryType.Add(SomeJewelry); } }
public void GetVenderCode(string vc) { JewelryType.Clear(); if (vc == "") { GetAllJewelry(); } else { Jewelry[] j = AllJewelries.Where(i => i.VenderCode == vc).ToArray <Jewelry>(); foreach (Jewelry i in j) { JewelryType.Add(i); } } }
public ActionResult DeleteConfirmed(int id) { JewelryType jewelryType = db.JewelryTypes.Find(id); // if type is in use return message if (db.Styles.Where(s => s.JewelryTypeId == id).Count() != 0) { ModelState.AddModelError("JewelryType", jewelryType.Name + " is in use by at least one style."); ViewBag.CompanyId = jewelryType.CompanyId; return(View(jewelryType)); } int companyId = jewelryType.CompanyId.Value; db.JewelryTypes.Remove(jewelryType); db.SaveChanges(); return(RedirectToAction("Index", new { companyId })); }
// GET: JewelryTypes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(RedirectToAction("Index", "Home")); } JewelryType jewelryType = db.JewelryTypes.Find(id); if (jewelryType == null) { return(HttpNotFound()); } ViewBag.CompanyId = jewelryType.CompanyId; ViewBag.CompanyName = db._Companies.Find(jewelryType.CompanyId)?.Name; ViewBag.CompanyHasLTIs = db.LaborTable.Where(lti => lti.CompanyId == jewelryType.CompanyId).Count() == 0; return(View(jewelryType)); }
public JewelryItem(string id, string name, string description, string icon, int max_c, float weight, int bprice, int sprice, bool sellable, bool usable, JewelryType type, PowerUps add, SuitEffectInfo set) : base(id, name, description, icon, max_c, weight, bprice, sprice, sellable, usable) { /*if(icon.Contains("Icon/Item/Jewelry/Necklace/")) * { * StringBuilder sb = new StringBuilder(icon); * sb.Replace("Icon/Item/Jewelry/Necklace/", ""); * icon = sb.ToString(); * } * else if(icon.Contains("Icon/Item/Jewelry/Belt/")) * { * StringBuilder sb = new StringBuilder(icon); * sb.Replace("Icon/Item/Jewelry/Belt/", ""); * icon = sb.ToString(); * } * else if(icon.Contains("Icon/Item/Jewelry/Ring/")) * { * StringBuilder sb = new StringBuilder(icon); * sb.Replace("Icon/Item/Jewelry/Ring/", ""); * icon = sb.ToString(); * }*/ switch (type) { case JewelryType.Necklace: type_name = "项链"; /*Icon = "Icon/Item/Jewelry/Necklace/" + icon;*/ break; case JewelryType.Belt: type_name = "腰饰"; /*Icon = "Icon/Item/Jewelry/Belt/" + icon;*/ break; case JewelryType.Ring: type_name = "戒指"; /*Icon = "Icon/Item/Jewelry/Ring/" + icon;*/ break; } this.jewelry_Type = type; if (add != null) { power_Add = add.Clone(); } ItemType = ItemType.Jewelry; ItemTypeName = "首饰"; IsEqu = false; enchant = null; StackAble = false; suitEffect = set; }
public void AddDefaultEntries(StyleViewModel svm) { // Get the cost data and find initial values for the Finishing Labor & Packaging Costs. Both are based on the style's jewelry type decimal flPrice = 0; decimal packPrice = 0; JewelryType jt = db.JewelryTypes.Where(j => svm.CompanyId == j.CompanyId).FirstOrDefault(); if (jt != null) { flPrice = jt.FinishingCost; packPrice = jt.PackagingCost; } // Add 2 Fixed Labor entries and 1 Fixed Misc entry LaborComponent lc = new LaborComponent { Id = -1, Name = StyleViewModel.FinishingLaborName, State = LMState.Fixed, PPP = flPrice, Qty = 1, Total = flPrice }; svm.Labors.Add(lc); MiscComponent mc = new MiscComponent { Id = -1, Name = StyleViewModel.PackagingName, State = SVMStateEnum.Fixed, PPP = packPrice, Qty = 1, Total = packPrice }; svm.Miscs.Add(mc); }
public static async Task <IEnumerable <JewelryDataGroup> > GetGroupByTypeAsync(JewelryType jewelryType) { await _jewelryDataSource.GetDataAsync(); // Simple linear search is acceptable for small data sets var matches = _jewelryDataSource.Groups.Where((group) => group.Type.Equals(jewelryType)); if (matches.Count() > 0) { return(matches); } return(null); }