Esempio n. 1
0
        protected void btnThem_Click(object sender, EventArgs e)
        {
            int csd;
            int csc;
            int dg;

            csd = Convert.ToInt16(txtChisocdau.Text);
            csc = Convert.ToInt16(txtChisocuoi.Text);
            dg  = Convert.ToInt16(txtDongia.Text);
            int tthu;

            tthu            = (csc - csd);
            txtTieuthu.Text = tthu.ToString();
            DN      dn    = LayDuLieuTuForm();
            QLDNDAO QLDAO = new QLDNDAO();
            bool    exist = QLDAO.checkmact(dn.MaCongToNuoc);

            if (exist)
            {
                lblThongBao.Text = "Mã công tơ nước đã tồn tại";
            }
            else
            {
                bool result = QLDAO.Them(dn);
                if (result)
                {
                    lblThongBao.Text = "Tính thành công";
                    LayDuLieuTuGirdview();
                }
                else
                {
                    lblThongBao.Text = "Lỗi";
                }
            }
        }
Esempio n. 2
0
        protected void btnSua_Click(object sender, EventArgs e)
        {
            int csd;
            int csc;
            int dg;

            csd = Convert.ToInt16(txtChisocdau.Text);
            csc = Convert.ToInt16(txtChisocuoi.Text);
            dg  = Convert.ToInt16(txtDongia.Text);
            int tthu;

            tthu            = (csc - csd);
            txtTieuthu.Text = tthu.ToString();
            DN      DN     = LayDuLieuTuForm();
            QLDNDAO QLDAO  = new QLDNDAO();
            bool    result = QLDAO.ChinhSua(DN);

            if (result)
            {
                lblThongBao.Text = "Cập nhật thành công : " + DN.NgayGhi;
                LayDuLieuTuGirdview();
            }
            else
            {
                lblThongBao.Text = "Cập nhật không thành công, vui lòng kiểm tra lại";
            }
        }
Esempio n. 3
0
        private void LayDuLieuTuGirdview()
        {
            QLDNDAO QLDAO = new QLDNDAO();

            gvNuoc.DataSource = QLDAO.ALL();
            gvNuoc.DataBind();
        }
Esempio n. 4
0
        protected void tinhThanhTien()
        {
            string  maCongToDien = txtMaCTD.Text;
            string  maCongToNuoc = txtMaCTN.Text;
            DienDAO dienDao      = new DienDAO();
            long    tienDien     = dienDao.getThanhTien(maCongToDien);

            QLDNDAO nuocDao  = new QLDNDAO();
            long    tienNuoc = nuocDao.getThanhTien(maCongToNuoc);

            TextBox1.Text = (tienDien + tienNuoc) + "";
        }
Esempio n. 5
0
        protected void btnTim_Click(object sender, EventArgs e)
        {
            string search = txtTim.Text;

            if (string.IsNullOrEmpty(search))
            {
                lblThongBao.Text = "Bạn phải nhập từ khóa trước khi tìm";
            }
            else
            {
                lblThongBao.Text = "Kết quả tìm kiếm";
                QLDNDAO QLDAO = new QLDNDAO();
                gvNuoc.DataSource = QLDAO.Tim(search);
                gvNuoc.DataBind();
            }
        }
Esempio n. 6
0
        protected void btnXoa_Click(object sender, EventArgs e)
        {
            string maCongToNuoc = txtMacongtonuoc.Text;

            QLDNDAO QLDAO = new QLDNDAO();

            bool result = QLDAO.Xoa(maCongToNuoc);

            if (result)
            {
                lblThongBao.Text = "Xóa thành công";
                LayDuLieuTuGirdview();
            }
            else
            {
                lblThongBao.Text = "Xóa không thành công, vui lòng kiểm tra lại!";
            }
        }