private void btnCancel_Click(object sender, EventArgs e)
        {
            Material_Releasing_Inquiry main = new Material_Releasing_Inquiry();

            this.Hide();
            main.Show();
        }
Пример #2
0
        private void TranSaveHeader(string Action)
        {
            string StringReturn = "";
            string status       = "";

            if (Action == "SAVE" || Action == "ADDNEW")
            {
                status = "Saved";
            }
            if (Action == "SUBMIT")
            {
                status = "Submitted";
            }
            SqlConnection con = new SqlConnection(conStr);
            SqlCommand    cmd = new SqlCommand();

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "TRAN_SAVE_MRI_HEADER";
            cmd.Parameters.Add("@MRIID", SqlDbType.VarChar, 50).Value        = txtMRIID.Text;
            cmd.Parameters.Add("@MRINO", SqlDbType.VarChar, 50).Value        = txtMRINo.Text;
            cmd.Parameters.Add("@Status", SqlDbType.VarChar, 50).Value       = status;
            cmd.Parameters.Add("@DateOfRelease", SqlDbType.DateTime).Value   = txtDateReleased.Text;
            cmd.Parameters.Add("@IssuedFrom", SqlDbType.Int).Value           = Convert.ToInt32(cmbIssueFrom.SelectedValue);
            cmd.Parameters.Add("@IssuedTo", SqlDbType.Int).Value             = Convert.ToInt32(cmbIssueTo.SelectedValue);
            cmd.Parameters.Add("@RequestedBy", SqlDbType.Int).Value          = Convert.ToInt32(cmbRequestedBy.SelectedValue);
            cmd.Parameters.Add("@IssuedBy", SqlDbType.Int).Value             = Convert.ToInt32(cmbIssuedBy.SelectedValue);
            cmd.Parameters.Add("@VerifiedBy", SqlDbType.Int).Value           = Convert.ToInt32(cmbVerifiedBy.SelectedValue);
            cmd.Parameters.Add("@UserCreated", SqlDbType.Int).Value          = Convert.ToInt32(TxtUserID.Text);
            cmd.Parameters.Add("@WithIssue", SqlDbType.Bit).Value            = Convert.ToBoolean(chkIssues.Checked);     //Convert.ToInt32(TxtUserID.Text);
            cmd.Parameters.Add("@Remarks", SqlDbType.VarChar, 50).Value      = rtxtRemarks.Text;                         //Convert.ToBoolean(chkIssues.Checked); //Convert.ToInt32(TxtUserID.Text);
            cmd.Parameters.Add("@ReferenceNo", SqlDbType.VarChar, 10).Value  = txtReferenceNo.Text;                      //rtxtRemarks.Text; //Convert.ToBoolean(chkIssues.Checked); //Convert.ToInt32(TxtUserID.Text);
            cmd.Parameters.Add("@CurrencyCode", SqlDbType.VarChar, 10).Value = cmbCurrencyCode.SelectedValue.ToString(); //rtxtRemarks.Text; //Convert.ToBoolean(chkIssues.Checked); //Convert.ToInt32(TxtUserID.Text);
            cmd.Parameters.Add("@TranType", SqlDbType.VarChar, 10).Value     = txttrantype.Text;
            cmd.Connection = con;
            try
            {
                con.Open();
                StringReturn = cmd.ExecuteScalar().ToString();
                ItemMasterLookUp formTask = new ItemMasterLookUp();
                if (Action == "SAVE" || Action == "SUBMIT")
                {
                    if (Action == "SAVE")
                    {
                        MessageBox.Show("Record Saved", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    }
                    if (Action == "SUBMIT")
                    {
                        MessageBox.Show("Record Submitted", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    }
                    Material_Releasing_Inquiry formTask2 = new Material_Releasing_Inquiry();
                    formTask2.GetUserID(TxtUserID.Text);
                    formTask2.GetTranType(txttrantype.Text);

                    this.Dispose();
                    formTask2.Show();
                }
                if (Action == "ADDNEW")
                {
                    formTask.Test(StringReturn, txttrantype.Text.ToString());
                    formTask.GetUserID(TxtUserID.Text);
                    formTask.GetTranType(txttrantype.Text, cmbIssueFrom.SelectedValue.ToString());
                    this.Dispose();
                    formTask.Show();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
                con.Dispose();
            }
        }