예제 #1
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            con.Open();
            SqlCommand    sa = new SqlCommand("select * from Item where itemCode='" + cmb_ic.SelectedItem + "' and itemQty>='" + Convert.ToInt32(txt_q.Text) + "'", con);
            SqlDataReader dr = sa.ExecuteReader();

            if (!dr.Read())
            {
                MessageBox.Show("Qty not available");
                con.Close();

                return;
            }

            CusOrderList customerorderlist = new CusOrderList()
            {
                Item = new Item()
                {
                    ItemCode  = Convert.ToInt16(dr[0].ToString()),
                    ItemName  = dr[1].ToString(),
                    ItemPrice = Convert.ToInt16(dr[2].ToString())
                },
                Orderqty = Convert.ToInt16(txt_q.Text),
                subtotal = Convert.ToInt16(txt_q.Text) * Convert.ToInt16(dr[2].ToString())
            };

            con.Close();
            dt.Rows.Add(customerorderlist.Item.ItemCode, customerorderlist.Item.ItemName, customerorderlist.Item.ItemPrice, customerorderlist.Orderqty, customerorderlist.subtotal);
            dataGridView1.DataSource = dt;
        }
예제 #2
0
        private void btn_co_Click(object sender, EventArgs e)
        {
            CusOrderList c = new CusOrderList()
            {
                cusOrder = new CusOrder
                {
                    orderNumber = Convert.ToInt32(txt_on.Text)
                },


                orderNumber = Convert.ToInt32(txt_on.Text)
            };

            c.cancelOrder(c.cusOrder.orderNumber);
            MessageBox.Show("Successfully deleted");
        }