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 AddItemBtn_Click(object sender, EventArgs e) { ProductPicture.Image = ProductPicture.InitialImage; ProductNametxt.Clear(); ProductIDtxt.Clear(); DesignCodetxt.Clear(); ColorTxt.ResetText(); EmbroideryStatus.Refresh(); AddItems.Show(); AddItems.BringToFront(); EditItem.TabStop = false; ViewAccount.TabStop = false; AccountSetting.TabStop = false; KameezaFabricTxt.Items.Clear(); ShalwarFabricTxt.Items.Clear(); DupattaFabricTxt.Items.Clear(); ColorTxt.Items.Clear(); Admin.ReadFabricInfo(ColorTxt, KameezaFabricTxt, ShalwarFabricTxt, DupattaFabricTxt); }