/// <summary> /// clear form text fields /// </summary> private void ClearAll() { ProductNOTxt.Clear(); ProductNameTxt.Clear(); ProductPriceTxt.Clear(); ProductQuantityTxt.Clear(); dateTimePicker2.Value = DateTime.Now; }
private void AddNewItem_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(ProductNametxt.Text) || string.IsNullOrWhiteSpace(ProductIDtxt.Text) || string.IsNullOrWhiteSpace(DesignCodetxt.Text) || string.IsNullOrWhiteSpace(ColorTxt.Text) || string.IsNullOrWhiteSpace(NumberOfPiecesTxt.Text) || string.IsNullOrWhiteSpace(QuantityInStockTxt.Text) || string.IsNullOrWhiteSpace(ProductPriceTxt.Text) || string.IsNullOrWhiteSpace(KameezaFabricTxt.Text) || string.IsNullOrWhiteSpace(ShalwarFabricTxt.Text) || string.IsNullOrWhiteSpace(DupattaFabricTxt.Text) || !IsImgUploaded) { MessageBox.Show("Please Fill All Fields And Mark Embroidery Status If Require"); } else { try { Admin.AddItem(ProductNametxt.Text, ProductIDtxt.Text, DesignCodetxt.Text, ColorTxt.Text, int.Parse(NumberOfPiecesTxt.Text), int.Parse(QuantityInStockTxt.Text), double.Parse(ProductPriceTxt.Text), KameezaFabricTxt.Text, ShalwarFabricTxt.Text, DupattaFabricTxt.Text, EmbroideryStatus.GetItemChecked(0), EmbroideryStatus.GetItemChecked(1), EmbroideryStatus.GetItemChecked(2), EmbroideryStatus.GetItemChecked(3), o1.FileName); ProductPicture.Image = ProductPicture.InitialImage; ProductNametxt.Clear(); ProductIDtxt.Clear(); DesignCodetxt.Clear(); ColorTxt.ResetText(); NumberOfPiecesTxt.ResetText(); QuantityInStockTxt.ResetText(); ProductPriceTxt.ResetText(); KameezaFabricTxt.ResetText(); ShalwarFabricTxt.ResetText(); DupattaFabricTxt.ResetText(); ProductPicture.Image = ProductPicture.InitialImage; //EmbroideryStatus.Refresh(); for (int i = 0; i < EmbroideryStatus.Items.Count; i++) { EmbroideryStatus.SetItemChecked(i, false); } } catch (System.Data.SqlClient.SqlException ex) { if (ex.Number == 2627) { MessageBox.Show("Product Id Already Reserved for some other product please try some other Id"); } } } }
private void ClearAll() { ProductNameTxt.Clear(); ProductPriceTxt.Clear(); ProductQuantityTxt.Clear(); }