Exemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            // vName , DDate

            /*mc = new MyConnection();
             * mc.conn.Open();
             *
             * cmd = new OleDbCommand("Select * from PO where POID = '"+comboBox1.Text+"'",mc.conn);
             * dr = cmd.ExecuteReader();
             * if(dr.Read())
             * {
             *  vname = dr["VName"].ToString();
             *  ddate = dr["DDate"].ToString();
             *
             * }*/


            // GRN Data Insertion
            mc = new MyConnection();
            mc.conn.Open();

            cmd = new OleDbCommand("Insert into GRN(GRNID,BaseDocument,Status,GRDate) values(@GRNID,@BaseDocument,@Status,@GRDate)", mc.conn);
            cmd.Parameters.AddWithValue("@GRNID", textBox3.Text);
            cmd.Parameters.AddWithValue("@BaseDocument", comboBox1.Text);
            cmd.Parameters.AddWithValue("@Status", "Open");
            cmd.Parameters.AddWithValue("@GRDate", System.DateTime.Today.Date.ToString());
            cmd.ExecuteNonQuery();
            MessageBox.Show("GRN Generate Completed ");

            cmd = new OleDbCommand("Select * from PO where POID = '" + comboBox1.Text + "'", mc.conn);
            dr  = cmd.ExecuteReader();
            if (dr.Read())
            {
                vname = dr["VName"].ToString();
                ddate = dr["DDate"].ToString();

                cmd = new OleDbCommand("Update GRN Set VName='" + dr["VName"].ToString() + "', DDAte = '" + dr["DDate"].ToString() + "' where GRNID = '" + textBox3.Text + "' ", mc.conn);
                cmd.ExecuteReader();
                MessageBox.Show("GRN table Complete");
                cmd = new OleDbCommand("Update PO set Status = 'Close' where POID ='" + comboBox1.Text + "'");
                MessageBox.Show("PO status Close");
            }
            mc.conn.Close();
        }
Exemplo n.º 2
0
        private void PurchaseOrder_Load(object sender, EventArgs e)
        {
            mc = new MyConnection();
            mc.conn.Open();
            cmd = new OleDbCommand("select VGroup from Vendor;", mc.conn);
            dr  = cmd.ExecuteReader();
            while (dr.Read())
            {
                comboBox1.Items.Add(dr["Vgroup"]);
            }
            mc.conn.Close();


            {
                mc = new MyConnection();
                mc.conn.Open();
                cmd = new OleDbCommand("select VID from Vendor;", mc.conn);
                dr  = cmd.ExecuteReader();
                while (dr.Read())
                {
                    comboBox2.Items.Add(dr["VID"]);
                }
                mc.conn.Close();
            }

            {
                mc = new MyConnection();
                mc.conn.Open();
                cmd = new OleDbCommand("select Pid from Products;", mc.conn);
                dr  = cmd.ExecuteReader();
                while (dr.Read())
                {
                    comboBox3.Items.Add(dr["Pid"]);
                }
                mc.conn.Close();
            }
        }