private void button1_Click(object sender, EventArgs e) { try { // DataGridViewSelectedRowCollection rows = gridView_ListTabaco.SelectedRows; foreach (DataGridViewRow row in rows) { string nameTobacco = row.Cells["name"].Value.ToString(); using (EntrepotBDDataContext db = new EntrepotBDDataContext()) { Tobacco tobacco = (from t in db.Tobaccos where String.Equals(t.name, nameTobacco) select t).FirstOrDefault(); db.Tobaccos.DeleteOnSubmit(tobacco); db.SubmitChanges(); } } ChargeDataGridview(); MessageBox.Show("success", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
// [ValidateAntiForgeryToken] public async Task <IActionResult> Edit(int id, [Bind("TobaccoId,Name,ShortDescription,LongDescription,Price,ImageURL,ImageThumbnailUrl,IsTobaccoBest,Available,CategoryyId")] Tobacco tobacco) { if (id != tobacco.TobaccoId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tobacco); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TobaccoExists(tobacco.TobaccoId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CategoryId"] = new SelectList(_context.Category, "CategoryId", "CategoryName", tobacco.CategoryId); return(View(tobacco)); }
private void button1_Click(object sender, EventArgs e) { using (EntrepotBDDataContext bd = new EntrepotBDDataContext()) { try { Tobacco tobaco = new Tobacco(); string name = txtNameTobacco.Text; int size = int.Parse(comboSize.SelectedValue.ToString()); int blend = int.Parse(comboBlend.SelectedValue.ToString()); int wrapper = int.Parse(comboWrapper.SelectedValue.ToString()); tobaco.size = size; tobaco.blend = blend; tobaco.wrapper = wrapper; tobaco.name = txtNameTobacco.Text; bd.Tobaccos.InsertOnSubmit(tobaco); bd.SubmitChanges(); MessageBox.Show("success", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); txtNameTobacco.Clear(); txtNameTobacco.Focus(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
public IActionResult Create(string name, string image, string taste, int weight, int price, string description) { Tobacco tobacco = new Tobacco { Name = name, Image = image, Taste = taste, Weight = weight, Price = price, Description = description }; tobaccoApiClient.Post("tobacco", tobacco); return(Redirect("Index")); }
public IActionResult Index(string name, string image, string taste, int weight, string description) { Tobacco tobacco = new Tobacco { Name = name, Image = image, Taste = taste, Weight = weight, Description = description }; tobaccoApiClient.Post("tobacco", tobacco); return(View(tobaccoApiClient.Get("tobacco"))); }
void Start() { cig = Tobacco.s_inst; ui = AccessUI.s_inst; ind_xpos = 8.2f * CameraController.aspect_multiplier; ui.rainDistanceIndicator.position = new Vector3(Camera.main.transform.position.x - ind_xpos, ui.rainDistanceIndicator.position.y, ui.rainDistanceIndicator.position.z); rb = GetComponent <Rigidbody2D>(); Move(true); }
void SettingRightCigarette() { GameObject tob = Instantiate(cigs[liveDataStorage.playingClass]); tob.transform.position = new Vector2(cigspawn.x, cigspawn.y); cig = tob.GetComponentInChildren <Tobacco>(); Camera.main.GetComponent <CameraController>().Target = cig.transform; Rain.s_inst.T_embers = cig.embers.transform; }
public IActionResult Edit(int id, string name, string image, string taste, int weight, int price, string description) { Tobacco tobacco = new Tobacco { Id = id, Name = name, Image = image, Taste = taste, Weight = weight, Price = price, Description = description }; tobaccoApiClient.Put("tobacco", tobacco); return(Redirect("Admin")); }
public async Task <Tobacco> Get(int id) { Tobacco tobacco = await db.Tobaccos.FirstOrDefaultAsync(x => x.Id == id); if (tobacco == null) { return(null); } return(tobacco); }
public async Task <Tobacco> Post(Tobacco tobacco) { if (tobacco == null) { return(null); } db.Tobaccos.Add(tobacco); await db.SaveChangesAsync(); return(tobacco); }
void Awake() { if (s_inst == null) { s_inst = this; } else { Destroy(s_inst); s_inst = this; } }
// [ValidateAntiForgeryToken] public async Task <IActionResult> Create([Bind("TobaccoId,Name,ShortDescription,LongDescription,Price,ImageURL,ImageThumbnailUrl,IsTobaccoBest,Available,CategoryyId")] Tobacco tobacco) { if (ModelState.IsValid) { _context.Add(tobacco); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CategoryId"] = new SelectList(_context.Category, "CategoryId", "CategoryName", tobacco.CategoryId); return(View(tobacco)); }
public async Task <Tobacco> Delete(int id) { Tobacco tobacco = db.Tobaccos.FirstOrDefault(x => x.Id == id); if (tobacco == null) { return(null); } db.Tobaccos.Remove(tobacco); await db.SaveChangesAsync(); return(tobacco); }
static void Main(string[] args) { var bread = new Necessity(3.50); TaxVisitor necessityTaxCalculator = new TaxVisitor(0.06); Console.WriteLine($"Bread price before tax: ${bread.Price}"); Console.ReadLine(); bread.Accept(necessityTaxCalculator); Console.WriteLine($"Bread price with tax: ${bread.Price}"); Console.ReadLine(); var bourbon = new Liquor(25.00); TaxVisitor liquorTaxCalculator = new TaxVisitor(0.18); Console.WriteLine($"Bourbon price before tax: ${bourbon.Price}"); Console.ReadLine(); bourbon.Accept(liquorTaxCalculator); Console.WriteLine($"Bourbon price with tax: ${bourbon.Price}"); Console.ReadLine(); var cigar = new Tobacco(8.50); TaxVisitor tobaccoTaxCalculator = new TaxVisitor(0.33); Console.WriteLine($"Cigar price before tax: ${cigar.Price}"); Console.ReadLine(); cigar.Accept(tobaccoTaxCalculator); Console.WriteLine($"Cigar price with tax: ${cigar.Price}"); Console.ReadLine(); Console.WriteLine("MEMORIAL DAY SALE! 10% OFF!"); Console.ReadLine(); SaleVisitor memorialDaySaleCalculator = new SaleVisitor(0.10); bread.Accept(memorialDaySaleCalculator); bourbon.Accept(memorialDaySaleCalculator); cigar.Accept(memorialDaySaleCalculator); Console.WriteLine($"Bread memorial day sale price: ${bread.Price}"); Console.WriteLine($"Bourbon memorial day sale price: ${bourbon.Price}"); Console.WriteLine($"Cigar memorial day sale price: ${cigar.Price}"); Console.ReadLine(); }
public async Task <Tobacco> Put(Tobacco tobacco) { if (tobacco == null) { return(null); } if (!db.Tobaccos.Any(x => x.Id == tobacco.Id)) { return(null); } db.Update(tobacco); await db.SaveChangesAsync(); return(tobacco); }
public bool SatisfiesPrefs(Tobacco tobacco) { if (group != FlavourGroup.None && group != tobacco.flavour.group) { return(false); } if (taste != Taste.None && taste != tobacco.flavour.taste) { return(false); } if (strength != Strength.None && strength != tobacco.brand.strength) { return(false); } return(true); }
public string Buy(int id) { Order order = (orderApiClient.Get("order").FirstOrDefault(x => x.Complete == false)); order.Tobaccos.Add(tobaccoApiClient.Get("tobacco", id)); Tobacco tobacco = tobaccoApiClient.Get("tobacco", id); Tobacco tobacco1 = tobaccoApiClient.Get("tobacco", id); tobaccoList.Add(tobacco); tobaccoList.Add(tobacco1); string s = null; foreach (var tobac in tobaccoList) { s += tobac.Name.ToString(); } return(s); }
public void ChooseTobacco() { FinallyChosenTobacco = tobaccos[currentValue]; }
public double Visit(Tobacco tobacco) { return(tobacco.Price * 0.2); }
public void AddTakeHookahAction(Tobacco tobacco) { actions.Enqueue(new TakeHookahAction(tobacco)); }
protected virtual void Awake() { _cigar = Tobacco.s_inst; }
public TakeHookahAction(Tobacco tobacco) { this.tobacco = tobacco; }
void Start() { _cig = Tobacco.s_inst; _rb = GetComponent <Rigidbody2D>(); deleteAfterX = 15f * CameraController.aspect_multiplier; }
void Awake() { _cigar = Tobacco.s_inst; _rb = GetComponent <Rigidbody2D>(); }