Пример #1
0
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            PurTable pt = new PurTable();

            pt.Show();
            this.Hide();
        }
Пример #2
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            int              iid  = 0;
            OracleCommand    cmdc = new OracleCommand("select * from purchase order by purchase_id", con);
            OracleDataReader odr  = cmdc.ExecuteReader();

            while (odr.Read())
            {
                iid = Int32.Parse((odr["purchase_id"].ToString()));
            }
            iid = iid + 1;
            if ((String.IsNullOrEmpty(date1.Text)) || (String.IsNullOrEmpty(sid.Text)) || (String.IsNullOrEmpty(did.Text)) || (String.IsNullOrEmpty(rate.Text)) || (String.IsNullOrEmpty(quantity.Text)))
            {
                MessageBox.Show("Some field(s) may have been left blank.");
            }
            else
            {
                double           r     = Double.Parse(rate.Text.ToString());
                int              q     = Int32.Parse(quantity.Text.ToString());
                double           total = q * r;
                OracleCommand    cmd   = new OracleCommand("insert into purchase values(" + iid + ",'" + date1.Text.ToString() + "'," + sid.Text.ToString() + "," + did.Text.ToString() + "," + rate.Text.ToString() + "," + quantity.Text.ToString() + "," + total.ToString() + ")", con);
                OracleDataReader odr1  = cmd.ExecuteReader();
                MessageBox.Show("Purchase Details Added Successfully.");
                PurTable a = new PurTable();
                this.Visibility = Visibility.Hidden;
                a.Show();
            }
        }