Example #1
0
        private void txtI_TextChanged(object sender, EventArgs e)
        {
            int tongtien = 0;

            giave1 = 0;
            int       giaveloai1;
            Chuyenbay chuyenbay = dt.Chuyenbays.Where(s => s.MaCB == label3.Text).FirstOrDefault();

            if (chuyenbay != null)
            {
                string a   = chuyenbay.MaCB.ToString();
                Ve     ve1 = dt.Ves.Where(s => s.MaCB == a.ToString()).FirstOrDefault();
                if (ve1 != null)
                {
                    giave1 = int.Parse(ve1.Giave);
                    giave1 = int.Parse(ve1.Giave);
                }
                if (txtI.Text == "")
                {
                    if (txtII.Text != "")
                    {
                        giaveloai1      = (giave2 * int.Parse(txtII.Text.Trim()) * 80) / 100;
                        tongtien        = giaveloai1;
                        lbTongTien.Text = tongtien.ToString();
                    }
                    else
                    {
                        lbTongTien.Text = "0";
                    }
                    return;
                }
                giaveloai1      = giave1 * int.Parse(txtI.Text.Trim());
                tongtien        = int.Parse(lbTongTien.Text);
                tongtien       += giaveloai1;
                lbTongTien.Text = tongtien.ToString();
                dt.SaveChanges();
                Form3_Load(sender, e);
            }
        }
Example #2
0
        private void txtII_TextChanged(object sender, EventArgs e)
        {
            QLBCMBEntities3 dt = new QLBCMBEntities3();

            giave2 = 0;
            int       giaveloai2, tongtien;
            Chuyenbay chuyenbay = dt.Chuyenbays.Where(s => s.MaCB == label3.Text).FirstOrDefault();

            if (chuyenbay != null)
            {
                string a   = chuyenbay.MaCB.ToString();
                Ve     ve1 = dt.Ves.Where(s => s.MaCB == a.ToString()).FirstOrDefault();

                giave2 = int.Parse(ve1.Giave);
                if (txtII.Text == "")
                {
                    if (txtI.Text != "")
                    {
                        giaveloai2      = giave1 * int.Parse(txtI.Text.Trim());
                        tongtien        = giaveloai2;
                        lbTongTien.Text = tongtien.ToString();
                    }
                    else
                    {
                        lbTongTien.Text = "0";
                    }
                    return;
                }
                giaveloai2      = (giave2 * int.Parse(txtII.Text.Trim())) * 80 / 100;
                tongtien        = int.Parse(lbTongTien.Text);
                tongtien       += giaveloai2;
                lbTongTien.Text = tongtien.ToString();
                // hoadon.Tongtien = tongtien;
                //hoadon.MaNV = txtmahd.Text;
                dt.SaveChanges();
                Form3_Load(sender, e);
            }
        }