private void button2_Click(object sender, EventArgs e) { if (textBox1.Text == "") { MessageBox.Show("Rejection Remarks is required.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); return; } string StringReturn = ""; SqlConnection con = new SqlConnection(conStr); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "TRAN_RejectPO"; cmd.Parameters.Add("@Tran_PO_ID", SqlDbType.Int).Value = Convert.ToInt32(txtPOID.Text); cmd.Parameters.Add("@UserID", SqlDbType.Int).Value = Convert.ToInt32(TxtUserID.Text); cmd.Parameters.Add("@ApprovalRemarks", SqlDbType.VarChar, -1).Value = textBox1.Text; cmd.Connection = con; try { con.Open(); StringReturn = cmd.ExecuteScalar().ToString(); if (StringReturn == "Approved") { MessageBox.Show("This Request is already Approved!.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); } else { MessageBox.Show("Request has been rejected", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); PoForApproval formTask = new PoForApproval(); formTask.GetUserID(TxtUserID.Text); this.Dispose(); formTask.Show(); } } catch (Exception ex) { throw ex; } finally { con.Close(); con.Dispose(); } }
private void PurchaseOrder_FormClosing(object sender, FormClosingEventArgs e) { if (stat.Text != "") { PoForApproval poInquiry = new PoForApproval(); poInquiry.GetUserID(TxtUserID.Text); poInquiry.Show(); this.Hide(); } else { POInquiry poInquiry = new POInquiry(); poInquiry.GetUserID(TxtUserID.Text); poInquiry.Show(); this.Hide(); } }