Beispiel #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");
        }
        protected void btnLuu_Click(object sender, EventArgs e)
        {
            DTOCongNoBanHang dto = new DTOCongNoBanHang();

            dto.MaDH      = lbMaDH.Text;
            dto.MaKH      = int.Parse(lbMaKH.Text);
            dto.MaNV      = int.Parse(txtMaNV.Text);
            dto.NgayTraNo = Convert.ToDateTime(lbNgayTra.Text);
            dto.TienTT    = int.Parse(txtTienTT.Text);

            DAO_Entity dao = new DAO_Entity();

            dao.ThemCongNoBH(dto);

            DTODonDatHang dtodh = new DTODonDatHang();

            dtodh.MaDH = lbMaDH.Text;
            int tong = int.Parse(lbTienTra.Text);
            int no   = int.Parse(txtTienTT.Text);

            dtodh.CongNoDH = tong - no;
            dao.CapNhatCongNo(dtodh);

            if (dtodh.CongNoDH == 0)
            {
                dao.CapNhatTrangThaisauThanhToan(dtodh);
            }

            Response.Redirect("~/QLBoPhan_ThanhPham/QuanLyQuanNo_BH/DanhSachCongNo_BH.aspx");
        }
Beispiel #3
0
        protected void btnLuuUser_Click(object sender, EventArgs e)
        {
            DTOUser dtond = new DTOUser();

            dtond.ID     = txtID.Text;
            dtond.MK     = txtMK.Text;
            dtond.HTuser = txtHoTen.Text;

            DTONhomQuyen dtonq = new DTONhomQuyen();

            dtonq.MaNQ     = int.Parse(ddlNhomQ.SelectedValue);
            dtonq.NhomQ    = ddlNhomQ.SelectedItem.ToString();
            dtond.dtoNhomQ = dtonq;

            DAO_Entity daond = new DAO_Entity();

            if (KiemTraNhap() == "")
            {
                daond.ThemUser(dtond);
                Response.Redirect("~/QLBophan_Admin/QLUser/User.aspx");
            }
            else
            {
                ThemUser.Visible = true;
                lbLoi.Text       = KiemTraNhap();
            }
        }
        public void LayDSCN_BH()
        {
            //DanhsachCongNoBH
            DAO_Entity dao = new DAO_Entity();

            dao.LayDSCongNoBH();
        }
        protected void btbLuu_Click(object sender, EventArgs e)
        {
            DTOThanhToan dtocn = new DTOThanhToan();

            dtocn.MaDH          = txtMaDH.Text;
            dtocn.MaNV          = int.Parse(txtNhanVien.Text);
            dtocn.NgayThanhToan = Convert.ToDateTime(txtNgayThanhToan.Text);
            dtocn.Sotien        = int.Parse(txtDatCoc.Text);
            dtocn.HanTT         = Convert.ToDateTime(txtHanTT.Text);



            DAO_Entity daokh = new DAO_Entity();

            XuLy_TiepNhanDonHang control = new XuLy_TiepNhanDonHang();

            control.themdatcoc(dtocn);

            DTODonDatHang dtodh = new DTODonDatHang();

            dtodh.MaDH = txtMaDH.Text;
            int tong = int.Parse(txtTong.Text);
            int no   = int.Parse(txtDatCoc.Text);

            dtodh.CongNoDH = tong - no;
            daokh.CapNhatCongNo(dtodh);


            Response.Redirect("~/QLBoPhan_TiepXucKH/TaoDonHang.aspx?MaKH=" + int.Parse(txtMaKH.Text));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                DTOKhachHang dto   = new DTOKhachHang();
                DAO_Entity   daokh = new DAO_Entity();

                XuLy_TiepNhanDonHang control = new XuLy_TiepNhanDonHang();
                control.LayDSKhachHang();

                List <DTOKhachHang> Dskh = daokh.TaoDSKH();
                GridDSKH.DataSource = Dskh;
                GridDSKH.DataBind();
            }
            catch (Exception)
            {
                Response.Write("<script>alert('Loi tai du lieu!')</script>");
            }
            ThemKH.Visible = false;


            if (IsPostBack == false)
            {
                List <DTOLoaiKH> dsLKH = new List <DTOLoaiKH>();
                DAO_Entity       daoKH = new DAO_Entity();
                dsLKH = daoKH.LayDSLKH();
                //hien thi ten loai KH ra dropdownlist
                ddLoaiKH.DataTextField = "TenLKH"; //TenLKH la thuoc tinh trong DTOLoaiKH
                //truyen dl theo ma loai
                ddLoaiKH.DataValueField = "MaLKH"; //MaLKH la thuoc tinh trong DTOLoaiKH
                ddLoaiKH.DataSource     = dsLKH;
                ddLoaiKH.DataBind();
            }
        }
        protected void btnTim_Click(object sender, EventArgs e)
        {
            DAO_Entity          dao      = new DAO_Entity();
            string              tendetim = txtTimTen.Text;
            List <DTOKhachHang> kqTim    = dao.TimTheoTenKH(tendetim);

            GridKH.DataSource = kqTim;
            GridKH.DataBind();
        }
        private string KiemTraNhap()
        {
            string     kq    = "";
            DAO_Entity daoKH = new DAO_Entity();

            if (txtTenLKH.Text.Trim() == "")
            {
                kq += "Vui lòng nhập tên!";
            }
            return(kq);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                hienThanhPhamChon();

                if (Session["dsThanhPhamChon"] == null)
                {
                    lbDSChon.Visible       = false;
                    lbTextTongTien.Visible = false;
                    lbTongTien.Visible     = false;
                    lbDSSanpham.Visible    = false;
                    grDSSanPham.Visible    = false;
                    gridDSChon.Visible     = false;
                }
                else
                {
                    lbDSChon.Visible       = true;
                    lbTextTongTien.Visible = true;
                    lbTongTien.Visible     = true;
                    lbDSSanpham.Visible    = true;
                    grDSSanPham.Visible    = true;
                    gridDSChon.Visible     = true;
                }
            }
            catch (Exception)
            {
                Response.Write("<script>alert('Loi tai du lieu!')</script>");
            }

            if (IsPostBack == false)//postback=false: chưa có sự kiện click trên web
            {
                // request: yeu cau. QueryString: lay gia tri cua chuoi tren duong dan
                string       makh        = Request.QueryString["MaKH"].ToString();
                DAO_Entity   daoEntities = new DAO_Entity();
                DTOKhachHang dtoKH       = daoEntities.LayTTKHTheoMa(makh);

                XuLy_TiepNhanDonHang control = new XuLy_TiepNhanDonHang();
                control.LayttKH(makh);

                lbMaKH.Text       = dtoKH.MaKH.ToString();
                txtTen.Text       = dtoKH.TenKH;
                txtNgayTaoDH.Text = DateTime.Now.ToShortDateString();


                List <DTODonDatHang> dsdh = daoEntities.LayDSDHTheoMa(makh);
                GridViewDH.DataSource = dsdh;
                GridViewDH.DataBind();
                grDSSanPham.DataSource = daoEntities.TaoDSSP();
                grDSSanPham.DataBind();
            }
        }
        protected void btnTim_Click(object sender, EventArgs e)
        {
            DAO_Entity daoKH = new DAO_Entity();

            XuLy_TiepNhanDonHang control = new XuLy_TiepNhanDonHang();

            control.TimtenKH(txtTim.Text.Trim());

            List <DTOKhachHang> kqTim = daoKH.TimTheoTenKH(txtTim.Text.Trim());

            GridDSKH.DataSource = kqTim;
            GridDSKH.DataBind();
        }
 protected void GridDSKH_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "cmdXoa")
     {
         LinkButton btnXoa = (LinkButton)e.CommandSource;
         string     MaKH   = btnXoa.CommandArgument;
         DAO_Entity daoKH  = new DAO_Entity();
         if (daoKH.XoaKhachHang(int.Parse(MaKH)) == true)
         {
             Response.Redirect("~/QLKhachHang/KhachHang.aspx");
         }
     }
 }
        protected void btLuuCt_Click(object sender, EventArgs e)
        {
            int               ma    = int.Parse(lbMadh.Text);
            DAO_Entity        daokh = new DAO_Entity();
            DTODonDatHang     dtodh = new DTODonDatHang();
            DTOChiTietDonHang dtoct = daokh.LayTongTien(ma);

            dtodh.TongTien = int.Parse(dtoct.ThanhTien.ToString());
            dtodh.CongNoDH = dtodh.TongTien;
            daokh.CapNhatTongTien(dtodh);

            Response.Redirect("~/QLBoPhan_TiepXucKH/TaoDonHang.aspx?MaKH=" + lbMaKH.Text);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         DAO_Entity          daokh = new DAO_Entity();
         List <DTOKhachHang> dsKH  = daokh.TaoDSKH();
         GridKH.DataSource = dsKH;
         GridKH.DataBind();
     }
     catch (Exception)
     {
         Response.Write("<script>alert('Loi tai du lieu!')</script>");
     }
 }
Beispiel #14
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack == false)
     {
         string               maPD  = Request.QueryString["MaPDVLCC"].ToString();
         DAO_Entity           daoPD = new DAO_Entity();
         DTOPhieuDatVatLieuCC dtoDH = daoPD.LayTTPhieuDatTheoMa(maPD);
         lbMPD.Text    = dtoDH.MaPDVLCC.ToString();
         lbNCC.Text    = dtoDH.dtoncc.MaNCC.ToString();
         lbTenNCC.Text = dtoDH.TenNCC.ToString();
         lbNTT.Text    = DateTime.Now.ToShortDateString();
         lbTong.Text   = dtoDH.CongNoNCC.ToString();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         DAO_Entity daokh = new DAO_Entity();
         List <DTOPhieuDatVatLieuCC> dsdh = daokh.LayDSCongNoNCC();
         GridView1.DataSource = dsdh;
         GridView1.DataBind();
     }
     catch (Exception)
     {
         Response.Write("<script>alert('Loi tai du lieu!')</script>");
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack == false)
     {
         string        maDH  = Request.QueryString["MaDH"].ToString();
         DAO_Entity    daoDH = new DAO_Entity();
         DTODonDatHang dtoDH = daoDH.LayDHTheoMa(maDH);
         lbMaDH.Text    = dtoDH.MaDH.ToString();
         lbMaKH.Text    = dtoDH.MaKH.ToString();
         lbTenKH.Text   = dtoDH.TenKH.ToString();
         lbTienTra.Text = dtoDH.CongNoDH.ToString();
         lbNgayTra.Text = DateTime.Now.ToShortDateString();
     }
 }
Beispiel #17
0
        protected void ddTP_SelectedIndexChanged(object sender, EventArgs e)
        {
            XemDSKho.Visible = true;
            int          masp  = int.Parse(ddTP.SelectedValue);
            DAO_Entity   daoKH = new DAO_Entity();
            DTOSanPhamCT dtosp = daoKH.LayGiaSPTheoMaCT(masp);

            lbgia.Text = dtosp.Gia.ToString();

            int        ma  = int.Parse(ddTP.SelectedValue);
            DAO_Entity dao = new DAO_Entity();
            DTOKhoSP   dto = dao.LaySoLuongKhoSP(ma);

            lbSLKho.Text = dto.Soluong.ToString();
        }
Beispiel #18
0
        protected void btnThem_Click(object sender, EventArgs e)
        {
            ThemUser.Visible = true;
            //Response.Redirect("~/QLUser/ThemUser.aspx");

            if (IsPostBack == false)
            {
                List <DTONhomQuyen> dsnq  = new List <DTONhomQuyen>();
                DAO_Entity          daond = new DAO_Entity();
                //  dsnq = daond.LayDSNhomQuyen();

                ddlNhomQ.DataTextField = "NhomQuyen";

                ddlNhomQ.DataValueField = "MaNhomQ";
                ddlNhomQ.DataSource     = dsnq;
                ddlNhomQ.DataBind();
            }
        }
Beispiel #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack == false)
            {
                string maDH = Request.QueryString["MaDH"].ToString();

                Xuly_PhanboThanhPham control = new Xuly_PhanboThanhPham();
                control.LayDonHangTheoMa(maDH);

                DAO_Entity    daoDH = new DAO_Entity();
                DTODonDatHang dtoDH = daoDH.LayDHTheoMa(maDH);
                lbMaDH.Text = dtoDH.MaDH.ToString();
                lbKH.Text   = dtoDH.MaKH.ToString();
            }


            try
            {
                string madh = Request.QueryString["MaDH"].ToString();

                Xuly_PhanboThanhPham control = new Xuly_PhanboThanhPham();
                control.LayCTDH(madh);


                DAO_Entity          daokh = new DAO_Entity();
                List <DTOChiTietDH> dtoct = daokh.LayDSChiTietDH(madh);
                GridView1.DataSource = dtoct;
                GridView1.DataBind();

                List <DTOXuLyPhieuGiao> dto = daokh.LayDSPhieuGiao(madh);
                GridView3.DataSource = dto;
                GridView3.DataBind();

                control.LayDSkhosp();

                List <DTOKhoSP> dtok = daokh.LayDSKhoSP();
                GridView2.DataSource = dtok;
                GridView2.DataBind();
            }
            catch
            {
                Response.Write("<script>alert('Loi tai du lieu!')</script>");
            }
        }
Beispiel #20
0
        protected void btnLuuTT_Click(object sender, EventArgs e)
        {
            DTOTrangThai dtott = new DTOTrangThai();

            dtott.TenTT = txtTenTT.Text;

            DAO_Entity daott = new DAO_Entity();

            if (KiemTraNhap() == "")
            {
                daott.ThemTT(dtott);
                Response.Redirect("~/QLBophan_Admin/QLCauHinhTrangThai/TrangThai.aspx");
            }
            else
            {
                ThemTT.Visible = true;
                lbLoi.Text     = KiemTraNhap();
            }
        }
Beispiel #21
0
        protected void btnLuuSP_Click(object sender, EventArgs e)
        {
            DTOLoaiSP dtoLSP = new DTOLoaiSP();

            dtoLSP.TenLSP = txtLSP.Text;

            DAO_Entity daoLSP = new DAO_Entity();

            if (KiemTraNhap() == "")
            {
                daoLSP.ThemLoaiSP(dtoLSP);
                Response.Redirect("~/QLBophan_Admin/QLCauHinhLoaiSP/LoaiSP.aspx");
            }
            else
            {
                ThemLoaiSP.Visible = true;
                lbLoi.Text         = KiemTraNhap();
            }
        }
Beispiel #22
0
        private string KiemTraNhap()
        {
            string     kq    = "";
            DAO_Entity daoKH = new DAO_Entity();

            if (txtID.Text.Trim() == "")
            {
                kq += "Vui lòng nhập ID!";
            }
            if (txtMK.Text.Trim() == "")
            {
                kq += "<br>Vui lòng nhập Mật Khẩu!";
            }
            if (txtHoTen.Text.Trim() == "")
            {
                kq += "Vui lòng nhập Họ Tên!";
            }
            return(kq);
        }
        protected void btnLuuKH_Click(object sender, EventArgs e)
        {
            DTOLoaiKH dtoLKH = new DTOLoaiKH();

            dtoLKH.TenLKH = txtTenLKH.Text;

            DAO_Entity daoLKH = new DAO_Entity();

            if (KiemTraNhap() == "")
            {
                daoLKH.ThemLoaiKH(dtoLKH);
                Response.Redirect("~/QLBophan_Admin/QLCauHinhLoaiKH/LoaiKH.aspx");
            }
            else
            {
                ThemLoaiKH.Visible = true;
                lbLoi.Text         = KiemTraNhap();
            }
        }
        private string KiemTraNhap()
        {
            string     kq    = "";
            DAO_Entity daoKH = new DAO_Entity();

            if (txtTen.Text.Trim() == "")
            {
                kq += "Vui lòng nhập tên!";
            }
            if (txtSDT.Text.Trim() == "")
            {
                kq += "Vui Lòng nhập SDT!";
            }
            if (txtDiaChi.Text.Trim() == "")
            {
                kq += "Vui Lòng nhập địa chỉ!";
            }
            return(kq);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (IsPostBack == false)
                {
                    XuLy_NhapTP control = new XuLy_NhapTP();
                    control.LayDHdangXL();

                    DAO_Entity entities = new DAO_Entity();
                    gridDSDonHang.DataSource = entities.LayDSDonHangDangXuLy();
                    gridDSDonHang.DataBind();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #26
0
        protected void btnThemSP_Click(object sender, EventArgs e)
        {
            XemDSKho.Visible = true;
            DTOXuLyPhieuGiao dtoct = new DTOXuLyPhieuGiao();

            // DTODonDatHang dtoDH = new DTODonDatHang();

            dtoct.MaDH = lbMaDH.Text;
            DTOSanPham dtoSP = new DTOSanPham();

            dtoct.MaSP = int.Parse(ddTP.SelectedValue);
            // dtoSP.TenSP = ddTP.SelectedItem.ToString();

            //dtoct.dtoSP = dtoSP;
            //dtoct.dtoDH = dtoDH;

            //dtoSP.TenSP = ddTP.SelectedValue;
            dtoct.SoLuong = int.Parse(txtSoLuong.Text);

            dtoct.ThanhTien = int.Parse(lbgia.Text) * int.Parse(txtSoLuong.Text);


            //BLLXuLyDonHang bll = new BLLXuLyDonHang();
            //bll.ThemChiTietDH(dtoct);


            DTOKhoSP dtokho = new DTOKhoSP();

            dtokho.MaSP    = int.Parse(ddTP.SelectedValue);
            dtokho.Soluong = int.Parse(lbSLKho.Text) - int.Parse(txtSoLuong.Text);
            DAO_Entity dao = new DAO_Entity();

            dao.CapNhatSLKhoSP(dtokho);



            DAO_Entity daokh = new DAO_Entity();

            daokh.ThemPhieuGiaoHang(dtoct);
            Response.Redirect(Request.RawUrl);
        }
        protected void btnLu_Click(object sender, EventArgs e)
        {
            DTONhacungcap dtoncc = new DTONhacungcap();

            dtoncc.TenNCC = txtTen.Text;
            dtoncc.Sdt    = txtSDT.Text;
            dtoncc.Diachi = txtDiaChi.Text;

            DAO_Entity daoncc = new DAO_Entity();

            if (KiemTraNhap() == "")
            {
                daoncc.ThemNhaCungCap(dtoncc);
                Response.Redirect("~/QLBophan_Admin/QLCauHinhNCC/NCC.aspx");
            }
            else
            {
                ThemNCC.Visible = true;
                lbLoi.Text      = KiemTraNhap();
            }
        }
        public void LayCTDH(string ma)
        {
            DAO_Entity dao = new DAO_Entity();

            dao.LayDSChiTietDH(ma);
        }
        public void xuatpgiao(DTOXuLyPhieuGiao dtoCtDH)
        {
            DAO_Entity dao = new DAO_Entity();

            dao.ThemPhieuGiaoHang(dtoCtDH);
        }
        public void LayDSkhosp()
        {
            DAO_Entity dao = new DAO_Entity();

            dao.LayDSKhoSP();
        }