public void GenProducts() { int num = 1; proset = new ProductSet(); foreach (Train t in tt) { foreach (StopStation ss in t.StaList) { for (int i = t.StaList.IndexOf(ss); i < t.StaList.Count - 1; i++) { Product p = new Product() { ProID = num++, StartStation = ss.StationName, EndStation = t.StaList[i + 1].StationName, Train = t }; double f = 0; for (int j = t.StaList.IndexOf(ss) + 1; j <= i + 1; j++) { f += (t.StaList[j].MileStone - t.StaList[j - 1].MileStone) * Math.Pow(settings.PriceDeclineRatio, j - t.StaList.IndexOf(ss) - 1); } p.Fare = f * t.PriceRatio; for (int j = t.StaList.IndexOf(ss); j < i + 1; j++) { //p.Add(t.SecList[j]); } proset.Add(p); } } } }
private void GenPro() { DataTable Pro = _ds.Tables["Pro"]; proset = new ProductSet(); foreach (DataRow dr in Pro.Rows) { Product p = new Product() { ProID = Convert.ToInt32(dr["ID"]), Description = dr["Des"].ToString(), Fare = Convert.ToDouble(dr["Fare"]) }; string s = dr["Res"].ToString(); foreach (string ss in s.Split(',')) { Resource temp = ResSet.Find(i => i.ResID == Convert.ToInt32(ss)); if (temp != null) { p.Add(temp); } } proset.Add(p); } }
internal static Product ProductSetToProduct(this ProductSet product) { Mapper.Initialize(cfg => cfg.CreateMap <ProductSet, Product>()); var result = Mapper.Map <ProductSet, Product>(product); return(result); }
private void InitCollections() { _unitGroups = new UnitGroupSet(this); _packages = new PackageSet(this); _routes = new RouteSet <Shape>(this); _products = new ProductSet <Shape>(this); }
public ActionResult DeleteConfirmed(int id) { ProductSet productSet = db.ProductSet.Find(id); db.ProductSet.Remove(productSet); db.SaveChanges(); return(RedirectToAction("Index")); }
public void setData(ProductSet data) { this.data = data; this.button.Text = this.data.name.ToString(); this.label1.Text = this.data.count.ToString(); this.label2.Text = this.data.cost.ToString(); this.Enabled = this.data.count > 0; }
public void ClearAll() { tt = null; this.mar = null; pathList = null; proset = null; rs = null; }
public void AddProductSetTest() { var p = ProductSet.Random(); var c = ProductSets.Instance.Count; Obj.AddProductSet(p); Assert.AreEqual(c + 1, ProductSets.Instance.Count); Assert.AreEqual(p, ProductSets.Instance.Find(x => x.IsSameContent(p))); }
public ActionResult Edit([Bind(Include = "Id,Name,Price,Description")] ProductSet productSet) { if (ModelState.IsValid) { db.Entry(productSet).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(productSet)); }
public ActionResult Create([Bind(Include = "Id,Name,Price,Description")] ProductSet productSet) { if (ModelState.IsValid) { db.ProductSet.Add(productSet); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(productSet)); }
public ActionResult CreateProductSet(string name, string description) { var productSet = new ProductSet(); if (TryUpdateModel(productSet)) { Repository.Data.Save(productSet); } return(View("ProductSetView", GetProductSets())); }
public void Initialyze() { path = Path.Combine(boot.DebugDir, "Prices"); ps = new ProductSet(boot); psi = new psInit(boot); _U = new _UT_ProductSet(boot); _I = new _UT_psInit(boot); ////////////if (boot.Suppliers == null) System.Threading.Thread.Sleep(1000); //18/2//////Assert.IsNotNull(boot.Suppliers); ////////////gs.Init(boot); }
public ActionResult SaveUpdateProductSet(Guid productSetId) { var productSet = new ProductSet(); if (TryUpdateModel(productSet)) { var originProductSet = Repository.Data.Get <ProductSet>(productSetId); originProductSet.Name = productSet.Name; originProductSet.Description = productSet.Description; Repository.Data.Save(originProductSet); } return(Index()); }
// GET: Products/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProductSet productSet = db.ProductSet.Find(id); if (productSet == null) { return(HttpNotFound()); } return(View(productSet)); }
private void PSU(string name, string FileName, string validDate, int i0, string LoadDescr, params string[] rl) { var ps = new ProductSet(boot); var psi = new psInit(boot); ps.name = psi.name = psi.SheetN = name; ps.SuplName = supl.name; psi.FileName = FileName; // psi.SheetN = SheetN; if (!DateTime.TryParse(validDate, out ps.ValidUntil)) { ps.ValidUntil = Declaration.MinDate; } psi.i0 = i0; psi.LoadDescriptor = LoadDescr; ps.RuleText = rl.ToList(); ps.Update(psi); }
public IList <Product> GetProductList(string nameCode, string group, int selection) { ProductSet prodset = ControllerManager.ProductSet.GetProductSet(selection); ICriteria crit = GetCriteria(); if (nameCode != null) { crit.Add(new OrExpression(new LikeExpression("ProductCode", nameCode, MatchMode.Anywhere), new LikeExpression("Description", nameCode, MatchMode.Anywhere))); } if (group != null) { crit.Add(new EqExpression("Group", group)); } if (selection > 0) { crit.Add(new EqExpression("ProductSets", prodset)); } return(crit.List <Product>()); }
public async Task <IActionResult> Create(ProductSetViewmodel model) { try { var division = await context.Divisions.FindAsync(model.DivisionId); if (division == null) { return(NotFound(new { message = $"Company division with ID {model.DivisionId} was not found." })); } var set = new ProductSet { Division = division, Name = model.Name }; var products = new List <Product>(); foreach (var p in model.Products) { var product = await context.Products.FindAsync(p.Id); if (product == null) { return(NotFound(new { message = $"Product with ID {p.Id} ({p.Name}) was not found." })); } products.Add(product); } set.Products = products; await context.ProductSets.AddAsync(set); await context.SaveChangesAsync(); return(Ok(set)); } catch (Exception ex) { _logger.LogError($"Unable to create product set", ex); return(BadRequest(ex.ToString())); } }
private void si(string suplName, string psName, string FileName, string SheetN, string LoadDescriptor) { Supplier supl = boot.Suppliers.AllSuppliers.Find(x => x.name == suplName); Assert.IsNotNull(supl, $"UT: Bad suplName={suplName}"); suplInit = boot.ssInit.Find(x => x.name == suplName); if (suplInit == null) { suplInit = new SupplierInit(boot); ProductSet ps = supl.productSets.Find(x => x.name == psName); if (ps == null) { ps = new ProductSet(boot); ps.name = psName; } psInit psi = new psInit(boot); psi.Copy(ps, FileName, SheetN, LoadDescriptor); suplInit.Copy(supl); suplInit.productSets.Add(psi); } }
public void UT_Update() { // ps.Update("СтальХолдинг"); string suplName = "СтальХолдинг"; string psName = "Лист"; var AllSuppliers = boot.Suppliers.AllSuppliers; Supplier supl = AllSuppliers.Find(x => x.name == suplName); ps = supl.productSets.Find(x => x.name.Contains(psName)); var supl_I = boot.ssInit.Find(x => x.name == suplName); var psi = supl_I.pssInit.Find(x => x.name.Contains(psName)); ps.Update(psi); Assert.AreEqual(ps.name, psName); Assert.AreEqual(ps.SuplName, suplName); Assert.IsTrue(ps.Products.Count > 1); }
public async Task <IActionResult> OnPostAsync() { try { var division = await context.Divisions.FindAsync(ProductSet.DivisionId); var set = new ProductSet { Division = division, Name = ProductSet.Name }; var products = new List <Product>(); foreach (var p in ProductSet.Products) { var product = await context.Products.FindAsync(p.Id); products.Add(product); } set.Products = products; await context.ProductSets.AddAsync(set); await context.SaveChangesAsync(); return(Redirect("Index")); } catch (Exception ex) { _logger.LogError($"Unable to save appointment: {ex}", ex); SaveSetErrorMessage = ex.ToString(); SaveSetError = true; return(Page()); } }
private void InitializeCollections() { _products = new ProductSet <Brand>(this); }
public Task SaveProductSetAsync(ProductSet ProductSet, Guid TemplateId) { throw new NotImplementedException(); }
public void SaveProductSet(ProductSet ProductSet, Guid TemplateId) { throw new NotImplementedException(); }
public ProductView GetOne(int id) => ProductSet.Where(x => x.Id == id).FirstOrDefault();
public IEnumerable <ProductView> GetAllForOwner(int ownerId) => ProductSet.Where(x => x.CreatedBy.Id == ownerId).ToList();
private void InitializeCollections() { _shapes = new ShapeSet <Package>(this); _products = new ProductSet <Package>(this); }
/// <summary> /// Modifies the set of products a user is entitled to access. /// Documentation https://developers.google.com/androidenterprise/v1/reference/users/setAvailableProductSet /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated AndroidEnterprise service.</param> /// <param name="enterpriseId">The ID of the enterprise.</param> /// <param name="userId">The ID of the user.</param> /// <param name="body">A valid AndroidEnterprise v1 body.</param> /// <returns>ProductSetResponse</returns> public static ProductSet SetAvailableProductSet(AndroidEnterpriseService service, string enterpriseId, string userId, ProductSet body) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (body == null) { throw new ArgumentNullException("body"); } if (enterpriseId == null) { throw new ArgumentNullException(enterpriseId); } if (userId == null) { throw new ArgumentNullException(userId); } // Make the request. return(service.Users.SetAvailableProductSet(body, enterpriseId, userId).Execute()); } catch (Exception ex) { throw new Exception("Request Users.SetAvailableProductSet failed.", ex); } }
public IEnumerable <ProductView> GetAllForAdmin() => ProductSet.Where(x => x.State == ProductState.UnProcessed).ToList();
public IEnumerable <ProductBaseView> GetCatalog() => ProductSet.Where(x => x.State == ProductState.InCatalog).ToList();