Beispiel #1
0
        private void linkLabel28_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            StallionSuppyChain.Purchase_Order.POInquiry PO = new StallionSuppyChain.Purchase_Order.POInquiry();
            PO.GetUserID(TxtUserID.Text);

            PO.Show();
        }
Beispiel #2
0
        private void button14_Click(object sender, EventArgs e)
        {
            StallionSuppyChain.Purchase_Order.POInquiry PO = new StallionSuppyChain.Purchase_Order.POInquiry();
            PO.GetUserID(TxtUserID.Text);

            PO.Show();
        }
        private void Transaction(string Action)
        {
            try
            {
                #region validation of required fields

                if (comboBox6.SelectedValue.ToString() == "0")
                {
                    MessageBox.Show("This field is required!.", "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation,
                                    MessageBoxDefaultButton.Button1);
                    return;
                }

                else if (ListPOApprovedBy.Text == " -- Select-- ")
                {
                    MessageBox.Show("This field is required!.", "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation,
                                    MessageBoxDefaultButton.Button1);
                    return;
                }
                else if (comboBox5.Text == " -- Select-- ")
                {
                    MessageBox.Show("This field is required!.", "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation,
                                    MessageBoxDefaultButton.Button1);
                    return;
                }
                else if (comboBox10.Text == " -- Select-- ")
                {
                    MessageBox.Show("This field is required!.", "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation,
                                    MessageBoxDefaultButton.Button1);
                    return;
                }
                else if (comboBox9.Text == " -- Select-- ")
                {
                    MessageBox.Show("This field is required!.", "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation,
                                    MessageBoxDefaultButton.Button1);
                    return;
                }
                else if (txtDPRate.Text == "")
                {
                    MessageBox.Show("This field is required!.", "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation,
                                    MessageBoxDefaultButton.Button1);
                    return;
                }
                else if (txtDPAmount.Text == "")
                {
                    MessageBox.Show("This field is required!.", "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation,
                                    MessageBoxDefaultButton.Button1);
                    return;
                }


                else if (comboBox11.Text == " -- Select-- ")
                {
                    MessageBox.Show("This field is required!.", "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation,
                                    MessageBoxDefaultButton.Button1);
                    return;
                }
                else if (txtRemarks.Text == "")
                {
                    MessageBox.Show("This field is required!.", "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation,
                                    MessageBoxDefaultButton.Button1);
                    return;
                }



                #endregion

                string saveData = saveGridData();

                if (saveData == "FAILED")
                {
                    MessageBox.Show("Please validate values on grid.", "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation,
                                    MessageBoxDefaultButton.Button1);
                    return;
                }


                if (txtForex.Text == "")
                {
                    txtForex.Text = "0";
                }


                SqlConnection con = new SqlConnection(conStr);
                SqlCommand    cmd = new SqlCommand();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "TRAN_SAVE_PO";
                cmd.Parameters.Add("@MRMID", SqlDbType.Int).Value                = Convert.ToInt32(txtMRMID.Text);
                cmd.Parameters.Add("@RequestNO", SqlDbType.VarChar, 20).Value    = textBox1.Text.ToString();
                cmd.Parameters.Add("@ProcurementID", SqlDbType.VarChar, 4).Value = comboBox6.SelectedValue.ToString();
                cmd.Parameters.Add("@Status", SqlDbType.VarChar, 15).Value       = Action;
                cmd.Parameters.Add("@WorkerID", SqlDbType.Int).Value             = Convert.ToInt32(ListPOApprovedBy.SelectedValue);
                cmd.Parameters.Add("@SupplierID", SqlDbType.Int).Value           = Convert.ToInt32(comboBox5.SelectedValue);
                cmd.Parameters.Add("@PaymentTermsID", SqlDbType.Int).Value       = Convert.ToInt32(comboBox10.SelectedValue);
                cmd.Parameters.Add("@DeliveryTermsID", SqlDbType.Int).Value      = Convert.ToInt32(comboBox9.SelectedValue);
                cmd.Parameters.Add("@DP_Rate", SqlDbType.Float).Value            = txtDPRate.Text;
                cmd.Parameters.Add("@DP_Amount", SqlDbType.Float).Value          = txtDPAmount.Text;
                cmd.Parameters.Add("@Forex", SqlDbType.Float).Value              = txtForex.Text;
                cmd.Parameters.Add("@Local_Purchase", SqlDbType.Bit).Value       = checkBox2.CheckState;
                cmd.Parameters.Add("@Vat_Inclusive", SqlDbType.Bit).Value        = checkBox3.CheckState;
                cmd.Parameters.Add("@Forex_Date", SqlDbType.DateTime).Value      = dateForexDate.Value;
                cmd.Parameters.Add("@Currency_Code", SqlDbType.VarChar, 3).Value = comboBox11.SelectedValue.ToString();
                cmd.Parameters.Add("@Remarks", SqlDbType.Text).Value             = txtRemarks.Text;
                cmd.Connection = con;
                con.Open();
                cmd.ExecuteNonQuery();
                MessageBox.Show("Record Saved", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                POInquiry poInquiry = new POInquiry();
                poInquiry.Show();
                this.Hide();
            }
            catch (Exception ex)
            {
                string errMessage = ex.InnerException == null ? ex.Message : ex.InnerException.Message;
                MessageBox.Show(errMessage);
            }
        }