Пример #1
0
        protected void btnLuu_Click(object sender, EventArgs e)
        {
            DTOCongNoVatLieu dtovl = new DTOCongNoVatLieu();

            dtovl.MaPDVLCC  = int.Parse(lbMPD.Text);
            dtovl.MaNCC     = int.Parse(lbNCC.Text);
            dtovl.MaNV      = int.Parse(TextBox1.Text);
            dtovl.NgayTraNo = Convert.ToDateTime(lbNTT.Text);
            dtovl.Sotien    = int.Parse(TextBox2.Text);

            DAO_Entity dao = new DAO_Entity();

            dao.ThemCongNoNCC(dtovl);


            DTOPhieuDatVatLieuCC dtopd = new DTOPhieuDatVatLieuCC();

            dtopd.MaPDVLCC = lbMPD.Text;
            int tong = int.Parse(lbTong.Text);
            int no   = int.Parse(TextBox2.Text);

            dtopd.CongNoNCC = tong - no;
            dao.CapNhatCongNoNCC(dtopd);

            Response.Redirect("~/QLBoPhan_VatLieu/QLCongNoNCC/DanhSachCongNo.aspx");
        }