private void AddItemButton_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Name.Text) && !string.IsNullOrEmpty(Price.Text) && !string.IsNullOrEmpty(Stock.Text)) { int IntTest; Double DoubleTest; Boolean Fail = true; while (Fail) { if (Double.TryParse(Price.Text, out DoubleTest)) { _Product.Price = Double.Parse(Price.Text); } else { MessageBox.Show("Not an acceptable price"); Fail = false; break; } if (Int32.TryParse(Stock.Text, out IntTest)) { _Product.Stock_Level = Int32.Parse(Stock.Text); } else { MessageBox.Show("Not an acceptable stock level"); Fail = false; break; } _Product.Product_Name = Name.Text; _Product.ProductId = _PHPRepo.GetMaxProductId() + 1; _PHPRepo.AddProductRecord(_Product); MessageBox.Show("New product added successfully."); StockList.Items.Clear(); List <Product> _NewList = _PHPRepo.GetProducts(); foreach (Product p in _NewList) { string[] row = { p.ProductId.ToString(), p.Product_Name.ToString(), p.Price.ToString(), p.Stock_Level.ToString() }; var listViewItem = new ListViewItem(row); StockList.Items.Add(listViewItem); } ; Name.Clear(); Price.Clear(); Stock.Clear(); Fail = false; break; } } else { MessageBox.Show("Please fill out all fields"); } }
private void Save_button_Click(object sender, EventArgs e) { productList = new List <Product>(); Product newProduct = new Product(); newProduct.Name = Name.Text; newProduct.Price = Convert.ToDouble(Price.Text); newProduct.Category = Category.Text; newProduct.Brand = Brand.Text; newProduct.Color = Color.Text; newProduct.Barcode = Convert.ToInt32(Barcode.Text); newProduct.Stock = Stock.Text; newProduct.Ad = Ad.Text; GridView.Rows.Add(newProduct.Name, newProduct.Price, newProduct.Category, newProduct.Brand, newProduct.Color, newProduct.Barcode, newProduct.Stock, newProduct.Ad); productList.Add(newProduct); Name.Clear(); Price.Clear(); Color.Clear(); Barcode.Clear(); Stock.Clear(); Ad.Clear(); }
private void Reset_Click(object sender, EventArgs e) { Height.Clear(); custombox.Text = "0"; Width.Clear(); Length.Clear(); Price.Clear(); Volume.Clear(); richTextBox1.Clear(); tooltypes1.SelectedIndex = 0; dropdown1.SelectedIndex = 0; dropdown2.SelectedIndex = 0; dropdown3.SelectedIndex = 0; dropdown4.SelectedIndex = 0; dropdown5.SelectedIndex = 0; dropdown2.Visible = false; dropdown3.Visible = false; dropdown4.Visible = false; dropdown5.Visible = false; VådstrålingFør.Checked = false; TørstrålingFør.Checked = false; VådstrålingEfter.Checked = false; TørstrålingEfter.Checked = false; stripning1.Checked = false; stripning2.Checked = false; efterpolering.Checked = false; StrålingAmount.Value = 1; label9.Visible = false; label9.ResetText(); }
private void button1_Click_1(object sender, EventArgs e) { foreach (DataGridViewRow row in TuiTour.SelectedRows) { row.Selected = false; } City_dpt.Clear(); Country.Clear(); Name.Clear(); Price.Clear(); Date.Clear(); Night.Clear(); }
private void insert_Click(object sender, EventArgs e) { check chk = new check(); chk.insert(item.Text, Convert.ToInt32(Price.Text)); MessageBox.Show("item Inserted !!"); item.Clear(); Price.Clear(); }
private void Clear_Click(object sender, EventArgs e) { RegNo.Clear(); cmbColor.Text = ""; cmbModel.Text = ""; Price.Clear(); cmbMake.Text = ""; Speed.Clear(); Vehicleid.Text = ""; }
private void ResetFormControls() { Id = 0; textBox1.Clear(); textBox2.Clear(); Dose.Clear(); Price.Clear(); textBox1.Focus(); }
private void AddToListOnClick(object sender, EventArgs e) { // Reset Background Color of textbox CarName.BackColor = Color.White; CarColor.BackColor = Color.White; Price.BackColor = Color.White; // Check if textbox are emty. Show error Message // and change background color of textbox if empty if (String.IsNullOrEmpty(CarName.Text) || String.IsNullOrEmpty(CarColor.Text) || String.IsNullOrEmpty(Price.Text)) { MessageBox.Show("Please make sure that all fields are not empty"); if (String.IsNullOrEmpty(CarName.Text)) { CarName.BackColor = Color.PaleVioletRed; } else if (String.IsNullOrEmpty(CarColor.Text)) { CarColor.BackColor = Color.PaleVioletRed; } else { Price.BackColor = Color.PaleVioletRed; } return; } // Check if numeric values are entered in the "Price" field // If not, show message and change background color of textbox if (!decimal.TryParse(Price.Text, out decimal parsedDecimal)) { MessageBox.Show(@"Please enter only numbers in the ""Price"" Field"); Price.BackColor = Color.PaleVioletRed; return; } // Add information to CarList Car car = new Car { Name = CarName.Text, Color = CarColor.Text, Price = parsedDecimal }; CarList.Add(car); // Clear textboxes and dropdown CarName.Clear(); CarColor.ResetText(); Price.Clear(); // Add the last item (the newest item) to the ListBox MyCarsList.Items.Add(String.Format(" - {0}, {1}, {2}\r\n", CarList[CarList.Count - 1].Name, CarList[CarList.Count - 1].Color, CarList[CarList.Count - 1].Price)); }
private void Pay(Invoice.InvoiceCurrency curr, Action <double> callback) { var inv = Invoice.New(); inv.Products = new List <Product>(DbContext.ProductCollection.FindAll()); inv.TotalPrice = Price.NumberValue; inv.Currency = curr; if (callback != null) { callback(inv.TotalPrice); } Price.Clear(); }
private void btnsabt_Click(object sender, EventArgs e) { //try //برای مدیریت خطا //{ OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Application.StartupPath + "\\Database.accdb"); //کدهای اتصال به پایگاه داده ها con.Open(); OleDbCommand com = new OleDbCommand(); //if (naghd.Checked) //{ // noe = "نقد"; //} //else //{ // noe = "چک"; //} if (comboBoxEx1.SelectedIndex == 0) { noe = "نقد"; } else if (comboBoxEx1.SelectedIndex == 1) { noe = "نقد و چک"; } com.CommandText = "insert into table1(name,family,mobile,codemeli,noebime,Price,noepardakht,baghimande) values('" + txtname.Text + "','" + txtfamily.Text + "','" + txtmobile.Text + "','" + Codemeli.Text + "','" + txtnobime.Text + "','" + Price.Text + "','" + noe + "','" + textBox2.Text + "')"; // کد درج در پایگاه داده ها com.Connection = con; com.ExecuteNonQuery(); con.Close(); MessageBox.Show("داده ها با موفقیت ثبت شدند"); txtname.Clear(); //پاک کردن تکست باکس ها txtfamily.Clear(); txtmobile.Clear(); txtnobime.Clear(); Codemeli.Clear(); Price.Clear(); // textBox1.Clear(); textBox2.Clear(); //} //catch //برای مدیریت خطا //{ // MessageBox.Show("خطا در اتصال به بانک اطلاعاتی"); //} }
internal string EditValidDataandSave(string typecode, string code, string desc, string price, string newtypecode, string newcode, string newdesc, string newprice) { int colnumber = SearchRecord(typecode, code, desc, price); if (colnumber < 0) { return("RecordNotFound"); } // Click edit button string editbtn = String.Format("(//a[@class='k-button k-button-icontext k-grid-Edit'][contains(.,'Edit')])[{0}]", colnumber); BrowserFactory.Driver.FindElement(By.XPath(editbtn)).Click(); // Select Time/Material TypeCode dropdown SelectTypeCode(newtypecode); //Enter code if (newcode != null) { codedrpdwn.Clear(); codedrpdwn.SendKeys(newcode); } // Enter description if (newdesc != null) { desctxtbox.Clear(); desctxtbox.SendKeys(newdesc); } // Enter Price if (newprice != null) { Price.Clear(); Price1.Clear(); Price.SendKeys(newprice); } // click save savebtn.Click(); return("success"); }
private void addToBasket_Click(object sender, EventArgs e) { string prodPrice = Price.Text; string prodQuant = Quantity.Text; string product = ProductName.Text; decimal quan = Convert.ToDecimal(prodQuant); decimal price = Convert.ToDecimal(prodPrice); string quan2 = Convert.ToString(quan); string price2 = Convert.ToString(price); var item = new ListViewItem(product); item.SubItems.Add(quan2); item.SubItems.Add(price2); basket.Items.Add(item); ProductName.Clear(); Quantity.Value = 0; Price.Clear(); }
public void clearNewBookFields() { //Book Info Title.Clear(); Author.Clear(); Pages.Clear(); Genre.Clear(); Publisher.Clear(); Price.Clear(); //author info AuthorName.Clear(); AuthorEmail.Clear(); AuthorAddress.Clear(); AuthorPNum.Clear(); AuthorAccNum.Clear(); AuthorCut.Clear(); authorList.Items.Clear(); }
private void Add_in_Main_list(object sender, RoutedEventArgs e) { float price = 0; price = Convert.ToUInt64(Price.Text); using (var context = new LoginDBEntities()) { var product = new ProductFromStore() { UserName = UserName.Text, ProductName = Product.Text, Price = price }; context.ProductFromStores.Add(product); context.SaveChanges(); UserName.Clear(); Product.Clear(); Price.Clear(); MessageBox.Show("You add in main list"); } }
private void Button_Click(object sender, RoutedEventArgs e) { float price = 0; price = Convert.ToUInt64(Price.Text); using (var context = new LoginDBEntities()) { var product = new tableCustomer() { UserName = login, ProductName = Product1.Text, Price = price }; context.tableCustomers.Add(product); context.SaveChanges(); Product1.Clear(); Price.Clear(); MessageBox.Show("You buy it!!"); } }
private void btnOK_Click(object sender, EventArgs e) { if (pictureBox1.Image != null && TName.Text != "" && Price.Text != "" && Speed.Text != "" && Producer.Text != "" && Country.Text != "") { ListViewItem item = new ListViewItem(TName.Text); item.SubItems.Add(Price.Text); item.SubItems.Add(Speed.Text); item.SubItems.Add(Producer.Text); item.SubItems.Add(Country.Text); item.ImageIndex = imgPos; lv.Items.Add(item); pictureBox1.Image = null; TName.Clear(); Price.Clear(); Speed.Clear(); Country.Clear(); Producer.Clear(); } else { MessageBox.Show("Заповніть всі поля"); } }
private void add_Click(object sender, EventArgs e) { if (City_dpt.Text != "" && Country.Text != "" && Name.Text != "" && Price.Text != "" && Date.Text != "" && Night.Text != "") { DialogResult dr = MessageBox.Show("Добавить запись?", "Добавление", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (dr == DialogResult.OK) { bool flag = false; for (int i = 0; i < tour.Count; i++) { if (City_dpt.Text == tour[i].City && Country.Text == tour[i].Country1 && Name.Text == tour[i].Name1 && Price.Text == tour[i].Price1 && Date.Text == tour[i].dateofdep.ToString() && Night.Text == tour[i].numberofnights) { flag = true; } } if (!flag) { this.Validate(); this.toursBindingSource.EndEdit(); DataRow nRow = tiuDataSet2.Tables[0].NewRow(); nRow["Город отправления"] = City_dpt.Text.ToString(); nRow["Страна назначения"] = Country.Text.ToString(); nRow["Название тура"] = Name.Text.ToString(); CultureInfo MyCultureInfo = new CultureInfo("en-US"); nRow["Стоимость"] = Price.Text.ToString(); nRow["Дата вылета"] = DateTime.ParseExact(Date.Text.ToString(), "dd.M.yyyy", MyCultureInfo); nRow["Количество ночей"] = Night.Text.ToString(); tiuDataSet2.Tables[0].Rows.Add(nRow); toursTableAdapter.Update(tiuDataSet2.Tours); tiuDataSet2.Tables[0].AcceptChanges(); TuiTour.Refresh(); Fn.update(this.TuiTour, this.tour); City_dpt.Clear(); Country.Clear(); Name.Clear(); Price.Clear(); Date.Clear(); Night.Clear(); } if (flag) { DialogResult er = MessageBox.Show("Такая запись уже существует!", "Добавление", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); } } } else { DialogResult dr = MessageBox.Show("Некорректный ввод! Поля пусты.", "Добавление", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } }