//add product details private void p_save_button_Click(object sender, EventArgs e) { if (p_pid_txt.Text == "") { pid_label.Visible = true; } else if (p_cat_com.Text == "") { p_category_label.Visible = true; } else if (p_size_com.Text == "") { p_size_label.Visible = true; } else if (p_colour_txt.Text == "") { p_colour_label.Visible = true; } else if (p_uprice_txt.Text == "") { p_uprice_label.Visible = true; } else if (p_sprice_txt.Text == "") { p_uprice_label.Visible = true; } else if (p_profit_txt.Text == "") { p_uprice_label.Visible = true; } else if (p_quality_rating_com.Text == "") { p_quality_label.Visible = true; } else if (richTextBox1 == null) { p_details_label.Visible = true; } else { string a = Convert.ToString(p_quality_rating_com.SelectedItem); string id = p_pid_txt.Text.Substring(0, 1); if (((id == "O") && a == "Grade A") || a == "Grade B" || a == "Grade C" || a == "Grade D") { string month = Convert.ToString(product_dateTime.Value.Date); DateTime m = Convert.ToDateTime(month); string month1 = m.ToString("MM"); if (dba.add_details(p_pid_txt.Text, Convert.ToString(p_cat_com.SelectedItem), Convert.ToString(p_size_com.SelectedItem), p_colour_txt.Text, p_uprice_txt.Text, p_sprice_txt.Text, p_profit_txt.Text, Convert.ToString(p_quality_rating_com.SelectedItem), richTextBox1.Text, p_allocation_label2.Text, Convert.ToString(product_dateTime.Value.Date), month1)) { MessageBox.Show("Successfully updated!"); } else { MessageBox.Show("Error!"); } f3.Show(); this.Dispose(); f3.FillGrid2(); } else if (a == "Grade E") { string month = Convert.ToString(product_dateTime.Value.Date); DateTime m = Convert.ToDateTime(month); string month1 = m.ToString("MM"); if (dba.rejected_details(p_pid_txt.Text, Convert.ToString(p_cat_com.SelectedItem), p_allocation_label2.Text, p_uprice_txt.Text, Convert.ToString(p_quality_rating_com.SelectedItem), Convert.ToString(product_dateTime.Value.Date), month1)) { MessageBox.Show("Successfully updated!"); } else { MessageBox.Show("Error!"); } f3.Show(); this.Dispose(); f3.FillGrid5(); } else if (id != "O" && a == "Grade A") { if (dba.export_details(p_pid_txt.Text, Convert.ToString(p_cat_com.SelectedItem), p_allocation_label2.Text, p_uprice_txt.Text, p_sprice_txt.Text, p_profit_txt.Text, Convert.ToString(p_quality_rating_com.SelectedItem), richTextBox1.Text, Convert.ToString(product_dateTime.Value.Date))) { MessageBox.Show("Successfully updated!"); } else { MessageBox.Show("Error!"); } f3.Show(); this.Dispose(); f3.FillGrid6(); //button7.Visible = false; //remove_button.Visible = false; //update_button.Visible = false; } } p_pid_txt.Clear(); p_cat_com.Text = ""; p_size_com.Text = ""; p_colour_txt.Clear(); p_uprice_txt.Clear(); p_sprice_txt.Clear(); p_profit_txt.Clear(); p_quality_rating_com.Text = ""; richTextBox1.Text = ""; }
private void o_back_button_Click(object sender, EventArgs e) { f3.Visible = true; f3.FillGrid5(); this.Dispose(); }