private void add_create_pnl4_btn_Click(object sender, EventArgs e) { //validation string valid = Advertisment.validation(Aname_create_pnl4_txt.Text, type_create_pnl4_ddl.Items[type_create_pnl4_ddl.SelectedIndex].ToString(), recieve_create_pnl4_txt.Text, from_create_pnl4_txt.Text, to_create_pnl4_txt.Text); if (valid != "") { MessageBox.Show(valid); return; } if (items.Count == 0) { MessageBox.Show("must add at least 1 item"); return; } int allow = 0; if (allow_create_pnl4_chk.Checked) { allow = 1; } int advNum = Advertisment.add(username, DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year, Aname_create_pnl4_txt.Text, type_create_pnl4_ddl.Items[type_create_pnl4_ddl.SelectedIndex].ToString(), recieve_create_pnl4_txt.Text, from_create_pnl4_txt.Text, to_create_pnl4_txt.Text, allow, policy_create_pnl4_ddl.Items[policy_create_pnl4_ddl.SelectedIndex].ToString()); for (int i = 0; i < items.Count; i = i + 4) { Products.add(advNum, items[i], items[i + 1], items[i + 2], items[i + 3], null); } items.Clear(); MessageBox.Show("success"); clearAdv(); }
private void Aupdate_pnl4_btn_Click(object sender, EventArgs e) { string valid = Advertisment.validation(Aname_create_pnl4_txt.Text, type_create_pnl4_ddl.Items[type_create_pnl4_ddl.SelectedIndex].ToString(), recieve_create_pnl4_txt.Text, from_create_pnl4_txt.Text, to_create_pnl4_txt.Text); if (aID == -1) { return; } if (valid != "") { MessageBox.Show(valid); return; } int allow = 0; if (allow_create_pnl4_chk.Checked) { allow = 1; } Advertisment.update(aID, DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year, Aname_create_pnl4_txt.Text, type_create_pnl4_ddl.Items[type_create_pnl4_ddl.SelectedIndex].ToString(), recieve_create_pnl4_txt.Text, from_create_pnl4_txt.Text, to_create_pnl4_txt.Text, allow, policy_create_pnl4_ddl.Items[policy_create_pnl4_ddl.SelectedIndex].ToString()); MessageBox.Show("success"); }