示例#1
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (cbobhyt.Text == "co")
            {
                clvienphicobhyt cl = new clvienphicobhyt();
                float           tienkham, soluongthuoc, dongiathuoc;
                float           kq = 0;
                tienkham            = cl.chuyensangso(txttienkham.Text);
                soluongthuoc        = cl.chuyensangso(txtsoluongthuoc.Text);
                dongiathuoc         = cl.chuyensangso(txtdongiathuoc.Text);
                kq                  = cl.tinhvienphi(tienkham, soluongthuoc, dongiathuoc);
                txttinhvienphi.Text = cl.chuyensangchuoi(kq);
                strsql              = "update tbvienphi set tongtienvienphi='" + txttinhvienphi.Text + "' where mabn='" + cbomabn.Text + "'";
                objcmd              = new SqlCommand(strsql, objcon);

                objcmd.ExecuteNonQuery();
                Hienthi();
            }
            else if (cbobhyt.Text == "khong")
            {
                clvienphicobhyt cl = new clvienphicobhyt();
                float           tienkham, soluongthuoc, dongiathuoc;
                float           kq = 0;
                tienkham            = cl.chuyensangso(txttienkham.Text);
                soluongthuoc        = cl.chuyensangso(txtsoluongthuoc.Text);
                dongiathuoc         = cl.chuyensangso(txtdongiathuoc.Text);
                kq                  = cl.tinhvienphi1(tienkham, soluongthuoc, dongiathuoc);
                txttinhvienphi.Text = cl.chuyensangchuoi(kq);
                strsql              = "update tbvienphi set tongtienvienphi='" + txttinhvienphi.Text + "' where mabn='" + cbomabn.Text + "'";
                objcmd              = new SqlCommand(strsql, objcon);

                objcmd.ExecuteNonQuery();
                Hienthi();
            }
        }
        private void button4_Click(object sender, EventArgs e)
        {
            if (cbobhyt.Text=="co")
            {
                clvienphicobhyt cl = new clvienphicobhyt();
                float tienkham, soluongthuoc, dongiathuoc;
                float kq = 0;
                tienkham = cl.chuyensangso(txttienkham.Text);
                soluongthuoc = cl.chuyensangso(txtsoluongthuoc.Text);
                dongiathuoc = cl.chuyensangso(txtdongiathuoc.Text);
                kq = cl.tinhvienphi(tienkham, soluongthuoc, dongiathuoc);
                txttinhvienphi.Text = cl.chuyensangchuoi(kq);
                strsql = "update tbvienphi set tongtienvienphi='" + txttinhvienphi.Text + "' where mabn='" + cbomabn.Text + "'";
                objcmd = new SqlCommand(strsql, objcon);

                objcmd.ExecuteNonQuery();
                Hienthi();
            }
            else if (cbobhyt.Text=="khong")
            {
                clvienphicobhyt cl = new clvienphicobhyt();
                float tienkham, soluongthuoc, dongiathuoc;
                float kq = 0;
                tienkham = cl.chuyensangso(txttienkham.Text);
                soluongthuoc = cl.chuyensangso(txtsoluongthuoc.Text);
                dongiathuoc = cl.chuyensangso(txtdongiathuoc.Text);
                kq = cl.tinhvienphi1(tienkham, soluongthuoc, dongiathuoc);
                txttinhvienphi.Text = cl.chuyensangchuoi(kq);
                strsql = "update tbvienphi set tongtienvienphi='" + txttinhvienphi.Text + "' where mabn='" + cbomabn.Text + "'";
                objcmd = new SqlCommand(strsql, objcon);

                objcmd.ExecuteNonQuery();
                Hienthi();
            }

            

        }