private void closeButton_Click(object sender, EventArgs e)
        {
            this.Hide();
            PreviousOrderList frm = new PreviousOrderList();

            frm.Show();
        }
Exemplo n.º 2
0
        private void btnWorkOrder_Click(object sender, EventArgs e)
        {
            this.Hide();
            PreviousOrderList frm = new PreviousOrderList();

            frm.Show();
        }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (txtImportOrderNo.Text == "")
            {
                MessageBox.Show("Please type Purchase Order", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtImportOrderNo.Focus();
                return;
            }
            if (invoiceNumberTextBox.Text == "")
            {
                MessageBox.Show("Please type  Invoice No", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                invoiceNumberTextBox.Focus();
                return;
            }
            if (packingListNoTextBox.Text == "")
            {
                MessageBox.Show("Please type Packing List No", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                packingListNoTextBox.Focus();
                return;
            }

            try
            {
                con = new SqlConnection(cs.DBConn);
                con.Open();
                string ct = "select ImportOrderNo from ImportOrder where ImportOrderNo='" + txtImportOrderNo.Text + "'";

                cmd            = new SqlCommand(ct);
                cmd.Connection = con;
                rdr            = cmd.ExecuteReader();

                if (rdr.Read())
                {
                    MessageBox.Show("This Import Order Already Exists", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtImportOrderNo.Text = "";
                    txtImportOrderNo.Focus();


                    if ((rdr != null))
                    {
                        rdr.Close();
                    }
                    return;
                }

                con = new SqlConnection(cs.DBConn);
                con.Open();
                string cb = "insert into ImportOrder(ImportOrderNo,OrderDate,LCNumber,LCDate,InvoiceNumber,InvoiceDate,PackingListNo,OrderStatus,ReceiveStatus,OrderByUId,OrderEntryDate) VALUES (@d1,@d2,@d3,@d4,@d5,@d6,@d7,@d8,@d9,@d10,@d11)";
                cmd            = new SqlCommand(cb);
                cmd.Connection = con;
                cmd.Parameters.AddWithValue("@d1", txtImportOrderNo.Text);
                cmd.Parameters.AddWithValue("@d2", Convert.ToDateTime(importOrderDate.Value, System.Globalization.CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat));
                cmd.Parameters.AddWithValue("@d3", lcNumberTextBox.Text);
                cmd.Parameters.AddWithValue("@d4", Convert.ToDateTime(lcDate.Value, System.Globalization.CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat));
                cmd.Parameters.AddWithValue("@d5", invoiceNumberTextBox.Text);
                cmd.Parameters.AddWithValue("@d6", Convert.ToDateTime(invoiceDate.Value, System.Globalization.CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat));
                cmd.Parameters.AddWithValue("@d7", packingListNoTextBox.Text);
                cmd.Parameters.AddWithValue("@d8", "NewOrder");
                cmd.Parameters.AddWithValue("@d9", "NewOrder");
                cmd.Parameters.AddWithValue("@d10", submittedBy);
                cmd.Parameters.AddWithValue("@d11", System.DateTime.UtcNow.ToLocalTime());
                cmd.ExecuteReader();
                con.Close();

                con = new SqlConnection(cs.DBConn);
                con.Open();
                string cty4 = "select Name from Registration where UserId='" + submittedBy + "'";
                cmd            = new SqlCommand(cty4);
                cmd.Connection = con;
                rdr            = cmd.ExecuteReader();
                if (rdr.Read())
                {
                    fullName = (rdr.GetString(0));
                }
                MessageBox.Show("Successfully Submitted.", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information);

                Reset3();
                this.Dispose();
                this.Hide();
                PreviousOrderList frm = new PreviousOrderList();
                frm.GetData2();
                frm.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }