Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var id = Request["ID"];
        var dichVuList = new List<PhieuDichVuDichVu>();
        var listThuChi = new List<ThuChi>();
        using (var con = DAL.con())
        {
            if (string.IsNullOrEmpty(id))
            {
                Item = PhieuDichVuDal.SelectDraff(con);
                Item.Ma = Item.Ma == 0 ? 1 : Item.Ma + 1;
                Item.ID = Guid.NewGuid();

            }
            else
            {
                Item = PhieuDichVuDal.SelectById(con, new Guid(id));
                dichVuList = PhieuDichVuDichVuDal.SelectByPdvId(con, id);
                listThuChi = ThuChiDal.SelectByPdvId(con, Item.ID);
            }
            Add.ListDichVu = dichVuList;
            Add.Item = Item; ;
            Add.ListThuChi = listThuChi;
            Add.ListUrl = "/lib/pages/PhieuDichVu/List-Kt.aspx";
        }
    }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var id = Request["ID"];
        var dichVuList=new List<PhieuDichVuDichVu>();
        var listDuyetAnh = new List<DuyetAnh>();
        var listBaiHat = new List<BaiHat>();
        var listThuChi = new List<ThuChi>();
        using (var con = DAL.con())
        {
            if (string.IsNullOrEmpty(id))
            {
                Item = PhieuDichVuDal.SelectDraff(con);
                Item.Ma = Item.Ma == 0 ? 1 : Item.Ma  + 1;
                Item.ID = Guid.NewGuid();
                Item.TuVanVien = Security.UserId;
                Item.TuVanVien_Ten = Security.Ten;

            }
            else
            {
                Item = PhieuDichVuDal.SelectById(con, new Guid(id));
                dichVuList = PhieuDichVuDichVuDal.SelectByPdvId(con, id);
                listDuyetAnh = DuyetAnhDal.SelectByPdvId(con, id);
                listBaiHat = BaiHatDal.SelectByPdvId(con, id);
                listThuChi = ThuChiDal.SelectByPdvId(con, Item.ID);
            }
            Add.ListDichVu = dichVuList;
            Add.Item = Item; ;
            Add.ListDuyetAnh = listDuyetAnh;
            Add.ListBaiHat = listBaiHat;
            Add.ListThuChi = listThuChi;
            Add.ListUrl = "/lib/pages/PhieuDichVu/Default.aspx";
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        var id = Request["ID"];
        var listDuyetAnh = new List<DuyetAnh>();
        var listBaiHat = new List<BaiHat>();
        using (var con = DAL.con())
        {
            if (string.IsNullOrEmpty(id))
            {
                Item = PhieuDichVuDal.SelectDraff(con);
                Item.Ma = Item.Ma == 0 ? 1 : Item.Ma + 1;
                Item.ID = Guid.NewGuid();

            }
            else
            {
                Item = PhieuDichVuDal.SelectById(con, new Guid(id));
                listDuyetAnh = DuyetAnhDal.SelectByPdvId(con, id);
                listBaiHat = BaiHatDal.SelectByPdvId(con, id);
                var logoStr = DanhMucDal.SelectByMa("BAOCAO-HEADER-THUCHI", con).Description;
                Add.LogoStr = logoStr;
            }
            Add.ListDuyetAnh = listDuyetAnh;
            Add.ListBaiHat = listBaiHat;
            Add.Item = Item; ;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        var id           = Request["ID"];
        var listDuyetAnh = new List <DuyetAnh>();
        var listBaiHat   = new List <BaiHat>();

        using (var con = DAL.con())
        {
            if (string.IsNullOrEmpty(id))
            {
                Item    = PhieuDichVuDal.SelectDraff(con);
                Item.Ma = Item.Ma == 0 ? 1 : Item.Ma + 1;
                Item.ID = Guid.NewGuid();
            }
            else
            {
                Item         = PhieuDichVuDal.SelectById(con, new Guid(id));
                listDuyetAnh = DuyetAnhDal.SelectByPdvId(con, id);
                listBaiHat   = BaiHatDal.SelectByPdvId(con, id);
                var logoStr = DanhMucDal.SelectByMa("BAOCAO-HEADER-THUCHI", con).Description;
                Add.LogoStr = logoStr;
            }
            Add.ListDuyetAnh = listDuyetAnh;
            Add.ListBaiHat   = listBaiHat;
            Add.Item         = Item;;
        }
    }
Ejemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var id           = Request["ID"];
        var dichVuList   = new List <PhieuDichVuDichVu>();
        var listDuyetAnh = new List <DuyetAnh>();
        var listBaiHat   = new List <BaiHat>();
        var listThuChi   = new List <ThuChi>();

        using (var con = DAL.con())
        {
            if (string.IsNullOrEmpty(id))
            {
                Item    = PhieuDichVuDal.SelectDraff(con);
                Item.Ma = Item.Ma == 0 ? 1 : Item.Ma + 1;
                Item.ID = Guid.NewGuid();
            }
            else
            {
                Item         = PhieuDichVuDal.SelectById(con, new Guid(id));
                dichVuList   = PhieuDichVuDichVuDal.SelectByPdvId(con, id);
                listDuyetAnh = DuyetAnhDal.SelectByPdvId(con, id);
                listBaiHat   = BaiHatDal.SelectByPdvId(con, id);
                listThuChi   = ThuChiDal.SelectByPdvId(con, Item.ID);
            }
            Add.ListDichVu   = dichVuList;
            Add.Item         = Item;;
            Add.ListDuyetAnh = listDuyetAnh;
            Add.ListBaiHat   = listBaiHat;
            Add.ListThuChi   = listThuChi;
            Add.ListUrl      = "/lib/pages/ThungRac/PhieuDichVu.aspx";
        }
    }
        private void InHoaDon(PhieuDichVu dv, List <CT_DichVu> ct)
        {
            FrmInHD inHD = new FrmInHD();

            inHD.print(dv, ct);
            inHD.ShowDialog();
        }
Ejemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var id = Request["ID"];
        var dichVuList = new List<PhieuDichVuDichVu>();
        var listDuyetAnh = new List<DuyetAnh>();
        var listBaiHat = new List<BaiHat>();
        using (var con = DAL.con())
        {
            if (string.IsNullOrEmpty(id))
            {
                Item = PhieuDichVuDal.SelectDraff(con);
                Item.Ma = Item.Ma == 0 ? 1 : Item.Ma + 1;
                Item.ID = Guid.NewGuid();

            }
            else
            {
                Item = PhieuDichVuDal.SelectById(con, new Guid(id));
                dichVuList = PhieuDichVuDichVuDal.SelectByPdvId(con, id);
                listDuyetAnh = DuyetAnhDal.SelectByPdvId(con, id);
                listBaiHat = BaiHatDal.SelectByPdvId(con, id);
            }
            Add.ListDichVu = dichVuList;
            Add.Item = Item; ;
            Add.ListDuyetAnh = listDuyetAnh;
            Add.ListBaiHat = listBaiHat;
        }
    }
        public void EditPhieuDichVu(PhieuDichVu p)
        {
            openConnection();
            string     query = "update PHIEUDICHVU set MaPhieuDangKy = @MaPhieuDangKy, TenDichVu = @TenDichVu, GiaDichVu = @GiaDichVu where MaPhieuDichVu = @MaPhieuDichVu";
            SqlCommand cmd   = new SqlCommand(query, Conn);

            cmd.Parameters.AddWithValue("@MaPhieuDichVu", p.MaPhieuDichVu);
            cmd.Parameters.AddWithValue("@MaPhieuDangKy", p.MaPhieuDangKy);
            cmd.Parameters.AddWithValue("@TenDichVu", p.TenDichVu);
            cmd.Parameters.AddWithValue("@GiaDichVu", p.GiaDichVu);
            cmd.ExecuteNonQuery();
        }
        public void insertPhieuDichVu(PhieuDichVu p)
        {
            openConnection();
            string     query = "insert into PHIEUDICHVU(MaPhieuDichVu, MaPhieuDangKy, TenDichVu, GiaDichVu) values (@MaPhieuDichVu, @MaPhieuDangKy, @TenDichVu, @GiaDichVu)";
            SqlCommand cmd   = new SqlCommand(query, Conn);

            cmd.Parameters.AddWithValue("@MaPhieuDichVu", p.MaPhieuDichVu);
            cmd.Parameters.AddWithValue("@MaPhieuDangKy", p.MaPhieuDangKy);
            cmd.Parameters.AddWithValue("@TenDichVu", p.TenDichVu);
            cmd.Parameters.AddWithValue("@GiaDichVu", p.GiaDichVu);
            cmd.ExecuteNonQuery();
        }
Ejemplo n.º 10
0
        public bool KTSoPhieuDV(string pSoPhieuDV)
        {
            PhieuDichVu phieuDichVu = nhakhoa.PhieuDichVus.Where(sp => sp.SoPhieuDV == pSoPhieuDV).FirstOrDefault();

            if (phieuDichVu != null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 11
0
        //Hóa đơn dịch vụ
        #region
        public string LayMaHoaDVTuSinh()
        {
            string      result = "AEON_MPDV" + 1.ToString().PadLeft(4, '0');
            PhieuDichVu hd     = db.PhieuDichVus.Where(x => x.MaPhieuDV.Contains($"AEON_MPDV"))
                                 .OrderByDescending(x => x.MaPhieuDV).FirstOrDefault();

            if (hd != null && !string.IsNullOrWhiteSpace(hd.MaPhieuDV))
            {
                int so = Convert.ToInt32(hd.MaPhieuDV.Replace("AEON_MPDV", "")) + 1;
                result = "AEON_MPDV" + so.ToString().PadLeft(4, '0');
            }
            return(result);
        }
Ejemplo n.º 12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var id = Request["ID"];
        if (string.IsNullOrEmpty(id)) id = PdvId;
        using (var con = DAL.con())
        {
            var selected = DuyetAnhDal.SelectByPdvId(con, id);

            var pdv = PhieuDichVuDal.SelectById(con, new Guid(id));
            Item = pdv;
            var listBaiHat = BaiHatDal.SelectByPdvId(con, id);
            var pdvDic = pdv.PTS_ThuMuc;
            if (string.IsNullOrEmpty(pdvDic)) pdvDic = ImgPath;
            var dic = new DirectoryInfo(pdvDic);

            var targetDic = Lib.ImgDomain() + pdvDic;

            var wc = new WebClient();
            var filesInTargetDic = wc.DownloadString(targetDic);
            if (string.IsNullOrEmpty(filesInTargetDic))
            {
            }
            else
            {
                var files = filesInTargetDic.Split(new char[] {'|'});

                var list = (from f in files
                            where f.Length > 1
                            select new DuyetAnh()
                                       {
                                           Ten = f
                                           ,
                                           FullName = string.Format("{0}{1}", targetDic, f)
                                       }).ToList();

                foreach (var item in selected)
                {
                    var items = list.FirstOrDefault(x => x.Ten.ToLower() == item.Ten.ToLower());
                    if (items == null) continue;
                    items.ID = item.ID;
                    items.Selected = true;
                    items.GhiChu = item.GhiChu;
                    items.ThuTu = item.ThuTu;
                }
                View.DuyetAnhs = list.Where(x => x.Selected).ToList();
                View.DanhSachAnh = list;
                View.Item = pdv;
                View.ListBaiHat = listBaiHat;
            }
        }
    }
Ejemplo n.º 13
0
        public void ThemPhieuDichVu(string pSoPhieuDV, string pMaBN, string pMaPhong, string pNgayLap)
        {
            PhieuDichVu phieuDichVu = new PhieuDichVu();

            phieuDichVu.SoPhieuDV  = pSoPhieuDV;
            phieuDichVu.MaBenhNhan = pMaBN;
            phieuDichVu.MaPhong    = pMaPhong;
            phieuDichVu.NgayLap    = DateTime.Parse(pNgayLap);
            phieuDichVu.TinhTrang  = "Chờ thực hiện";
            phieuDichVu.TongTien   = 0;
            phieuDichVu.ThanhToan  = "Chưa Thanh Toán";
            nhakhoa.PhieuDichVus.InsertOnSubmit(phieuDichVu);
            nhakhoa.SubmitChanges();
        }
Ejemplo n.º 14
0
        public bool KiemTraCoViPhamPhiDichVu(string ma)
        {
            DateTime    dateTime = DateTime.Now;
            string      nam      = dateTime.ToString("yyyy");
            string      thang    = dateTime.ToString("MM");
            PhieuDichVu kt       = db.PhieuDichVus.Where(
                t => t.MaThueMB.Equals(ma)).OrderByDescending(t => t.NgayLap).FirstOrDefault();

            if (kt != null && kt.TinhTrang != 1)
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 15
0
        public bool XoaHoaDonDichVu(string maHD)
        {
            try
            {
                PhieuDichVu hd = db.PhieuDichVus.Where(t => t.MaPhieuDV.Equals(maHD)).FirstOrDefault();
                db.PhieuDichVus.DeleteOnSubmit(hd);
                db.SubmitChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);

                throw;
            }
        }
Ejemplo n.º 16
0
        public void print(PhieuDichVu dv, List <CT_DichVu> data)
        {
            XtraReport1 report = new XtraReport1();

            foreach (var item in report.Parameters)
            {
                item.Visible = false;
            }
            report.report((DateTime)dv.NgayLap, dv.MaThueMB, dv.ThueMatBang.DangKyThue.MaKhachHang,
                          dv.ThueMatBang.DangKyThue.KhachHang.SDT, dv.ThueMatBang.DangKyThue.KhachHang.Email,
                          dv.MaPhieuDV, dv.ThueMatBang.DangKyThue.KhachHang.HoTenKH, data);
            {
                documentViewer1.DocumentSource = report;
                report.CreateDocument();
            }
        }
Ejemplo n.º 17
0
        public bool ThemHoaDonDichVu(PhieuDichVu dv)
        {
            try
            {
                PhieuDichVu pdv = new PhieuDichVu();
                pdv = dv;
                db.PhieuDichVus.InsertOnSubmit(pdv);
                db.SubmitChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);

                throw;
            }
        }
Ejemplo n.º 18
0
        public bool SuaHoaDonDichVu(PhieuDichVu ct)
        {
            try
            {
                PhieuDichVu pdv = db.PhieuDichVus.Where(t => t.MaPhieuDV.Equals(ct.MaPhieuDV)).FirstOrDefault();
                pdv.TinhTrang = ct.TinhTrang;
                pdv.TongTien  = ct.TongTien;
                db.PhieuDichVus.InsertOnSubmit(pdv);
                db.SubmitChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);

                throw;
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        var id = Request["ID"];
        using (var con = DAL.con())
        {
            if (string.IsNullOrEmpty(id))
            {
                Item = PhieuDichVuDal.SelectDraff(con);
                Item.Ma = Item.Ma == 0 ? 1 : Item.Ma + 1;
                Item.ID = Guid.NewGuid();

            }
            else
            {
                Item = PhieuDichVuDal.SelectById(con, new Guid(id));
                Item._KhachHang = KhachHangDal.SelectById(Item.KH_ID, con);
            }
            var logoStr = DanhMucDal.SelectByMa("BAOCAO-HEADER-THUCHI", con).Description;
            Add.LogoStr = logoStr;
            Add.Item = Item; ;
        }
    }
Ejemplo n.º 20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var id         = Request["ID"];
        var dichVuList = new List <PhieuDichVuDichVu>();

        using (var con = DAL.con())
        {
            if (string.IsNullOrEmpty(id))
            {
                Item    = PhieuDichVuDal.SelectDraff(con);
                Item.Ma = Item.Ma == 0 ? 1 : Item.Ma + 1;
                Item.ID = Guid.NewGuid();
            }
            else
            {
                Item       = PhieuDichVuDal.SelectById(con, new Guid(id));
                dichVuList = PhieuDichVuDichVuDal.SelectByPdvId(con, id);
            }
            AddTd.Item       = Item;;
            AddTd.ListDichVu = dichVuList;
        }
    }
Ejemplo n.º 21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var id = Request["ID"];

        using (var con = DAL.con())
        {
            if (string.IsNullOrEmpty(id))
            {
                Item    = PhieuDichVuDal.SelectDraff(con);
                Item.Ma = Item.Ma == 0 ? 1 : Item.Ma + 1;
                Item.ID = Guid.NewGuid();
            }
            else
            {
                Item            = PhieuDichVuDal.SelectById(con, new Guid(id));
                Item._KhachHang = KhachHangDal.SelectById(Item.KH_ID, con);
            }
            var logoStr = DanhMucDal.SelectByMa("BAOCAO-HEADER-THUCHI", con).Description;
            Add.LogoStr = logoStr;
            Add.Item    = Item;;
        }
    }
Ejemplo n.º 22
0
        private void btnLuu_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (txtMaDK.EditValue == null)
            {
                MessageBox.Show("Hãy chọn mã thuê", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtMaDK.Focus();
                return;
            }
            if (string.IsNullOrEmpty(cboTrangThai.Text))
            {
                MessageBox.Show("Hãy chọn trạng thái", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                cboTrangThai.Focus();
                return;
            }
            if (txtSoDienCu.Text == txtSoDienMoi.Text && txtSoNuocMoi.Text == txtSoNuocCu.Text)
            {
                MessageBox.Show("Hãy chọn số điện nước", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtSoDienMoi.Focus();
                return;
            }

            if (check)
            {
                try
                {
                    PhieuDichVu pdv = new PhieuDichVu();
                    pdv.MaPhieuDV     = txtHoaDon.EditValue.ToString();
                    pdv.NgayLap       = Commons.ConvertStringToDate(txtNgayLap.Text);
                    pdv.NgayThanhToan = Commons.ConvertStringToDate(txtNgayLap.Text);
                    pdv.TongTien      = tongTien;
                    if (cboTrangThai.SelectedIndex == 1)
                    {
                        pdv.TinhTrang = 1;
                    }
                    else
                    {
                        pdv.TinhTrang = 0;
                    }
                    pdv.MaThueMB   = txtMaDK.EditValue.ToString();
                    pdv.MaNhanVien = maNV;
                    CT_DichVu ctdvDien = new CT_DichVu();
                    ctdvDien.MaPhieuDV = txtHoaDon.EditValue.ToString();
                    ctdvDien.MaDichVu  = "AEON_MDV0001";
                    ctdvDien.ChiSoMoi  = int.Parse(txtSoDienMoi.EditValue.ToString());
                    ctdvDien.ChiSoCu   = int.Parse(txtSoDienCu.EditValue.ToString());
                    ctdvDien.Gia       = thueMB.LayGiaDien();
                    CT_DichVu ctdvNuoc = new CT_DichVu();
                    ctdvNuoc.MaPhieuDV = txtHoaDon.EditValue.ToString();
                    ctdvNuoc.MaDichVu  = "AEON_MDV0002";
                    ctdvNuoc.ChiSoMoi  = int.Parse(txtSoNuocMoi.EditValue.ToString());
                    ctdvNuoc.ChiSoCu   = int.Parse(txtSoNuocCu.EditValue.ToString());
                    ctdvNuoc.Gia       = thueMB.LayGiaNuoc();
                    bool keys = true;
                    if (!thueMB.ThemHoaDonDichVu(pdv))
                    {
                        keys = false;
                        thueMB.XoaHoaDonDichVu(pdv.MaPhieuDV);
                    }
                    if (!thueMB.ThemCTHoaDonDichVu(ctdvDien) || !thueMB.ThemCTHoaDonDichVu(ctdvNuoc))
                    {
                        keys = false;
                        thueMB.XoaCTHoaDonDichVu(pdv.MaPhieuDV);
                    }
                    if (keys)
                    {
                        DialogResult r = MessageBox.Show("Thêm hóa đơn thành công, bạn có muốn in hóa đơn không", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                        DAL.ThongBao tt = new DAL.ThongBao();
                        tt.NgayTao   = Commons.ConvertStringToDate(txtNgayLap.Text);
                        tt.TaiKhoan  = pdv.ThueMatBang.DangKyThue.KhachHang.SDT;
                        tt.MaLoaiTT  = 1;
                        tt.TrangThai = 1;
                        tt.NoiDung   = string.Format(QL_MatBang.NOIDUNGTHONGBAO, (DateTime.Now).Month + "/" + (DateTime.Now).Year);
                        tt.TieuDe    = QL_MatBang.TIEUDETHONGBAO;
                        thueMB.ThemThongBaoDichVu(tt);
                        if (thueMB.KiemTraToken(dgvDSHoaDon.GetFocusedRowCellDisplayText(colKhachHang)))
                        {
                            Root                    root         = new Root();
                            Notification            notification = new Notification();
                            NotificationForCustomer thongbao     = new NotificationForCustomer();
                            root.to                      = thueMB.LayToken(dgvDSHoaDon.GetFocusedRowCellDisplayText(colKhachHang));
                            notification.title           = tt.TieuDe;
                            notification.body            = tt.NoiDung;
                            notification.mutable_content = "True";
                            notification.sound           = "Tri-tone";
                            root.notification            = notification;
                            thongbao.ThongBaoChoKhachHang(root);
                        }


                        if (r == DialogResult.Yes)
                        {
                            PhieuDichVu p = new PhieuDichVu();
                            p = thueMB.LayThongTinPhieuDV(txtHoaDon.EditValue.ToString());
                            List <CT_DichVu> c = new List <CT_DichVu>();
                            c = thueMB.LayThongTinCT_DichVu2(txtHoaDon.EditValue.ToString());
                            InHoaDon(p, c);
                        }
                    }
                    Click_BtnLuu();
                    LoadDSHoaDon();
                    LoadCboMaThue();
                    LoadCboAllMaThue();
                    dgvDSHoaDon_FocusedRowChanged(null, null);
                }
                catch (Exception)
                {
                    MessageBox.Show("Đã có lỗi xẩy ra", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    throw;
                }
            }
            else
            {
                PhieuDichVu pdv = new PhieuDichVu();
                pdv.TongTien = tongTien;
                if (cboTrangThai.SelectedIndex == 1)
                {
                    pdv.TinhTrang = 1;
                }
                else
                {
                    pdv.TinhTrang = 0;
                }
                var ctdvd = thueMB.LayThongTinCT_DichVu(txtMaDK.EditValue.ToString(), "AEON_MDV0001");
                var ctdvm = thueMB.LayThongTinCT_DichVu(txtMaDK.EditValue.ToString(), "AEON_MDV0002");



                if (!thueMB.SuaHoaDonDichVu(pdv))
                {
                    MessageBox.Show("Đã có lỗi xẩy ra không thể sửa hóa đơn", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (!ctdvd.ChiSoMoi.ToString().Equals(txtSoDienMoi.EditValue))
                {
                    CT_DichVu ctdvDien = new CT_DichVu();
                    ctdvd.MaPhieuDV   = txtHoaDon.EditValue.ToString();
                    ctdvDien.MaDichVu = "AEON_MDV0001";
                    ctdvDien.ChiSoMoi = int.Parse(txtSoDienMoi.EditValue.ToString());
                    if (!thueMB.SuaCTHoaDonDichVu(ctdvDien))
                    {
                        MessageBox.Show("Đã có lỗi xẩy ra không thể sửa hóa đơn", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                }
                if (!ctdvm.ChiSoMoi.ToString().Equals(txtSoNuocMoi.EditValue))
                {
                    CT_DichVu ctdvNuoc = new CT_DichVu();
                    ctdvd.MaPhieuDV   = txtHoaDon.EditValue.ToString();
                    ctdvNuoc.MaDichVu = "AEON_MDV0002";
                    ctdvNuoc.ChiSoMoi = int.Parse(txtSoDienMoi.EditValue.ToString());
                    if (!thueMB.SuaCTHoaDonDichVu(ctdvNuoc))
                    {
                        MessageBox.Show("Đã có lỗi xẩy ra không thể sửa hóa đơn", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                }
                MessageBox.Show("Sửa thành công hóa đơn dịch vụ :" + txtHoaDon.EditValue, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Click_BtnLuu();
                LoadDSHoaDon();
                LoadCboMaThue();
                LoadCboAllMaThue();
                dgvDSHoaDon_FocusedRowChanged(null, null);
            }
        }
Ejemplo n.º 23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var logged = Security.IsAuthenticated();
        var Id = Request["Id"];
        var IdNull = string.IsNullOrEmpty(Id);
        var Ma = Request["Ma"];
        var KH_ID = Request["KH_ID"];
        var GDV_ID = Request["GDV_ID"];
        var TongTien = Request["TongTien"];
        var ChietKhau = Request["ChietKhau"];
        var DatCoc = Request["DatCoc"];
        var ThanhToan = Request["ThanhToan"];
        var ConNo = Request["ConNo"];
        var TuVanVien = Request["TuVanVien"];
        var NgayTuVan = Request["NgayTuVan"];
        var CHUP_NhanVien = Request["CHUP_NhanVien"];
        var CHUP_NgayBatDau = Request["CHUP_NgayBatDau"];
        var CHUP_NgayKetThuc = Request["CHUP_NgayKetThuc"];
        var CHUP_DiaDiem = Request["CHUP_DiaDiem"];
        var CHUP_LoaiAlbum = Request["CHUP_LoaiAlbum"];
        var CHUP_YeuCauKhach = Request["CHUP_YeuCauKhach"];
        var CHUP_DaChuyenAnh = Request["CHUP_DaChuyenAnh"];
        var CHUP_DaChuyenAnh_U = Request["CHUP_DaChuyenAnh_U"];
        var CHUP_NgayChuyenAnh = Request["CHUP_NgayChuyenAnh"];
        var TD_NhanVien = Request["TD_NhanVien"];
        var TD_NgayBatDau = Request["TD_NgayBatDau"];
        var TD_NgayKetThuc = Request["TD_NgayKetThuc"];
        var TOC_NhanVien = Request["TOC_NhanVien"];
        var TOC_NgayBatDau = Request["TOC_NgayBatDau"];
        var TOC_NgayKetThuc = Request["TOC_NgayKetThuc"];
        var TD_DiaDiem = Request["TD_DiaDiem"];
        var TD_KhoangCach = Request["TD_KhoangCach"];
        var TD_PhiDiLai = Request["TD_PhiDiLai"];
        var TD_KhoanPhaiThu = Request["TD_KhoanPhaiThu"];
        var PTS_NhanVien = Request["PTS_NhanVien"];
        var PTS_NhanVienDaNhan = Request["PTS_NhanVienDaNhan"];
        var PTS_NhanVienDaNhan_U = Request["PTS_NhanVienDaNhan_U"];
        var PTS_NgayXemMaket = Request["PTS_NgayXemMaket"];
        var PTS_NgayBatDau = Request["PTS_NgayBatDau"];
        var PTS_NgayKetThuc = Request["PTS_NgayKetThuc"];
        var PTS_YeuCauKhachHang = Request["PTS_YeuCauKhachHang"];
        var PTS_HenSanPham = Request["PTS_HenSanPham"];
        var PTS_DaCoSanPham = Request["PTS_DaCoSanPham"];
        var PTS_DaCoSanPham_U = Request["PTS_DaCoSanPham_U"];
        var PTS_NgayCoSanPham = Request["PTS_NgayCoSanPham"];
        var PTS_NgayLaySanPham = Request["PTS_NgayLaySanPham"];
        var PTS_AnhPhong = Request["PTS_AnhPhong"];
        var PTS_AnhPhongGhiChu = Request["PTS_AnhPhongGhiChu"];
        var PTS_AnhBan = Request["PTS_AnhBan"];
        var PTS_AnhBanGhiChu = Request["PTS_AnhBanGhiChu"];
        var PTS_AnhBanQuyCach = Request["PTS_AnhBanQuyCach"];
        var PTS_AnhBia = Request["PTS_AnhBia"];
        var PTS_CD3D = Request["PTS_CD3D"];
        var PTS_CD3D_U = Request["PTS_CD3D_U"];
        var PTS_AnhBiaMau = Request["PTS_AnhBiaMau"];
        var PTS_ThuMuc = Request["PTS_ThuMuc"];
        var HoanThanh = Request["HoanThanh"];
        var HoanThanh_U = Request["HoanThanh_U"];

        var Voucher = Request["Voucher"];
        var Voucher_Ma = Request["Voucher_Ma"];
        var NguoiTao = Request["NguoiTao"];
        var NguoiCapNhat = Request["NguoiCapNhat"];
        var NgayTao = Request["NgayTao"];
        var NgayCapNhat = Request["NgayCapNhat"];
        var Xoa = Request["Xoa"];
        var TrangThai = Request["TrangThai"];
        var Huy = Request["Huy"];
        var LyDoHuy = Request["LyDoHuy"];
        var NgayHuy = Request["NgayHuy"];
        var TD_NgoaiCanh = Request["TD_NgoaiCanh"];
        var TD_NgoaiCanh_U = Request["TD_NgoaiCanh_U"];

        var NhanVienHuy = Request["NhanVienHuy"];

        var DuyetEkip = Request["DuyetEkip"];
        var DeNghiDuyetEkip = Request["DeNghiDuyetEkip"];

        var CHUP_NgayBatDau_Gio = Request["CHUP_NgayBatDau_Gio"];
        var CHUP_NgayKetThuc_Gio = Request["CHUP_NgayKetThuc_Gio"];
        var TD_NgayBatDau_Gio = Request["TD_NgayBatDau_Gio"];
        var TD_NgayKetThuc_Gio = Request["TD_NgayKetThuc_Gio"];
        var TOC_NgayBatDau_Gio = Request["TOC_NgayBatDau_Gio"];
        var TOC_NgayKetThuc_Gio = Request["TOC_NgayKetThuc_Gio"];
        var PTS_NgayBatDau_Gio = Request["PTS_NgayBatDau_Gio"];
        var PTS_NgayKetThuc_Gio = Request["PTS_NgayKetThuc_Gio"];

        CHUP_DaChuyenAnh = !string.IsNullOrEmpty(CHUP_DaChuyenAnh_U) ? string.IsNullOrEmpty(CHUP_DaChuyenAnh) ? "false" : "true" : "";
        PTS_NhanVienDaNhan = !string.IsNullOrEmpty(PTS_NhanVienDaNhan_U) ? string.IsNullOrEmpty(PTS_NhanVienDaNhan) ? "false" : "true" : "";
        PTS_CD3D = !string.IsNullOrEmpty(PTS_CD3D_U) ? string.IsNullOrEmpty(PTS_CD3D) ? "false" : "true" : "";
        PTS_DaCoSanPham = !string.IsNullOrEmpty(PTS_DaCoSanPham_U) ?  string.IsNullOrEmpty(PTS_DaCoSanPham) ? "false" : "true" : "";
        Huy = string.IsNullOrEmpty(Huy) ? "false" : "true";
        HoanThanh = !string.IsNullOrEmpty(HoanThanh_U) ? string.IsNullOrEmpty(HoanThanh) ? "false" : "true" : "";
        DuyetEkip = string.IsNullOrEmpty(DuyetEkip) ? "false" : "true";
        TD_NgoaiCanh = !string.IsNullOrEmpty(TD_NgoaiCanh_U) ? string.IsNullOrEmpty(TD_NgoaiCanh) ? "false" : "true" : "";

        var refUrl = Request["refUrl"];
        if (!string.IsNullOrEmpty(refUrl))
            refUrl = Server.UrlDecode(refUrl);
        var q = Request["q"];

        switch (subAct)
        {
            case "save":
                #region Thêm phiếu dịch vụ

                if (Security.IsAuthenticated())
                {
                    var item = PhieuDichVuDal.SelectById(DAL.con(),new Guid(Id));
                    IdNull = item.ID == Guid.Empty;
                    item.ID=new Guid(Id);
                    if (IdNull)
                    {
                        item = new PhieuDichVu
                                   {
                                       ID = new Guid(Id),
                                       NgayTao = DateTime.Now,
                                       NguoiTao = Security.UserId
                                   };
                    }
                    item.NguoiCapNhat = Security.UserId;
                    item.NgayCapNhat = DateTime.Now;

                    if (Convert.ToBoolean(DuyetEkip))
                    {
                        if(!item.DuyetEkip)
                        {
                            item.NgayDuyetEkip = DateTime.Now;
                            item.NguoiDuyet = Security.UserId;
                        }
                    }
                    if (!string.IsNullOrEmpty(TD_NgoaiCanh))
                    {
                        item.TD_NgoaiCanh = Convert.ToBoolean(TD_NgoaiCanh);
                    }
                    if (!string.IsNullOrEmpty(DeNghiDuyetEkip))
                    {
                        item.DuyetEkip = Convert.ToBoolean(DuyetEkip);
                    }
                    if (!string.IsNullOrEmpty(Ma))
                    {
                        item.Ma = Convert.ToInt32(Ma);
                    }
                    if (!string.IsNullOrEmpty(KH_ID))
                    {
                        item.KH_ID = new Guid(KH_ID);
                    }
                    if (!string.IsNullOrEmpty(NgayTuVan))
                    {
                        item.NgayTuVan = Convert.ToDateTime(NgayTuVan, new CultureInfo("vi-vn"));
                    }

                    if (!string.IsNullOrEmpty(TuVanVien))
                    {
                        item.TuVanVien = Convert.ToInt32(TuVanVien);
                    }
                    if (!string.IsNullOrEmpty(GDV_ID))
                    {
                        item.GDV_ID = new Guid(GDV_ID);
                    }

                    // Chup anh
                    if (!string.IsNullOrEmpty(CHUP_NhanVien))
                    {
                        item.CHUP_NhanVien = Convert.ToInt32(CHUP_NhanVien);
                    }

                    if (!string.IsNullOrEmpty(CHUP_NgayBatDau) && !string.IsNullOrEmpty(CHUP_NgayBatDau_Gio))
                    {
                        item.CHUP_NgayBatDau = Convert.ToDateTime(string.Format("{0} {1}", CHUP_NgayBatDau, CHUP_NgayBatDau_Gio), new CultureInfo("vi-vn"));
                    }
                    if (!string.IsNullOrEmpty(CHUP_NgayBatDau) && !string.IsNullOrEmpty(CHUP_NgayKetThuc_Gio))
                    {
                        item.CHUP_NgayKetThuc = Convert.ToDateTime(string.Format("{0} {1}", CHUP_NgayBatDau, CHUP_NgayKetThuc_Gio), new CultureInfo("vi-vn"));
                    }
                    item.CHUP_DiaDiem = CHUP_DiaDiem;
                    item.CHUP_LoaiAlbum = CHUP_LoaiAlbum;
                    item.CHUP_YeuCauKhach = CHUP_YeuCauKhach;
                    if (!string.IsNullOrEmpty(CHUP_DaChuyenAnh))
                    {
                        item.CHUP_DaChuyenAnh = Convert.ToBoolean(CHUP_DaChuyenAnh);
                    }
                    item.Huy = Convert.ToBoolean(Huy);
                    // Trang diem
                    if (!string.IsNullOrEmpty(TD_NhanVien))
                    {
                        item.TD_NhanVien = Convert.ToInt32(TD_NhanVien);
                    }
                    if (!string.IsNullOrEmpty(TD_NgayBatDau) && !string.IsNullOrEmpty(TD_NgayBatDau_Gio))
                    {
                        item.TD_NgayBatDau = Convert.ToDateTime(string.Format("{0} {1}", TD_NgayBatDau, TD_NgayBatDau_Gio), new CultureInfo("vi-vn"));
                    }
                    if (!string.IsNullOrEmpty(TD_NgayBatDau) && !string.IsNullOrEmpty(TD_NgayKetThuc_Gio))
                    {
                        item.TD_NgayKetThuc = Convert.ToDateTime(string.Format("{0} {1}", TD_NgayBatDau, TD_NgayKetThuc_Gio), new CultureInfo("vi-vn"));
                    }
                    item.TD_DiaDiem = TD_DiaDiem;
                    if (!string.IsNullOrEmpty(TD_KhoangCach))
                    {
                        item.TD_KhoangCach = Convert.ToInt32(TD_KhoangCach);
                    }
                    if (!string.IsNullOrEmpty(TD_PhiDiLai))
                    {
                        item.TD_PhiDiLai = Convert.ToDouble(TD_PhiDiLai);
                    }
                    if (!string.IsNullOrEmpty(TD_KhoanPhaiThu))
                    {
                        item.TD_KhoanPhaiThu = Convert.ToDouble(TD_KhoanPhaiThu);
                    }

                    // Toc
                    if (!string.IsNullOrEmpty(TOC_NhanVien))
                    {
                        item.TOC_NhanVien = Convert.ToInt32(TOC_NhanVien);
                    }
                    if (!string.IsNullOrEmpty(TOC_NgayBatDau) && !string.IsNullOrEmpty(TOC_NgayBatDau_Gio))
                    {
                        item.TOC_NgayBatDau = Convert.ToDateTime(string.Format("{0} {1}", TOC_NgayBatDau, TOC_NgayBatDau_Gio), new CultureInfo("vi-vn"));
                    }
                    if (!string.IsNullOrEmpty(TOC_NgayBatDau) && !string.IsNullOrEmpty(TOC_NgayKetThuc_Gio))
                    {
                        item.TOC_NgayKetThuc = Convert.ToDateTime(string.Format("{0} {1}", TOC_NgayBatDau, TOC_NgayKetThuc_Gio), new CultureInfo("vi-vn"));
                    }

                    // Photoshop
                    if (!string.IsNullOrEmpty(PTS_NhanVien))
                    {
                        item.PTS_NhanVien = Convert.ToInt32(PTS_NhanVien);
                    }
                    if (!string.IsNullOrEmpty(PTS_NgayBatDau))
                    {
                        item.PTS_NgayBatDau = Convert.ToDateTime(PTS_NgayBatDau, new CultureInfo("vi-vn"));
                    }
                    if (!string.IsNullOrEmpty(PTS_NgayLaySanPham))
                    {
                        item.PTS_NgayLaySanPham = Convert.ToDateTime(PTS_NgayLaySanPham, new CultureInfo("vi-vn"));
                    }
                    if (!string.IsNullOrEmpty(PTS_NgayKetThuc))
                    {
                        item.PTS_NgayKetThuc = Convert.ToDateTime(PTS_NgayKetThuc, new CultureInfo("vi-vn"));
                    }
                    if (!string.IsNullOrEmpty(PTS_NhanVienDaNhan))
                    {
                        item.PTS_NhanVienDaNhan = Convert.ToBoolean(PTS_NhanVienDaNhan);
                    }

                    if (!string.IsNullOrEmpty(PTS_NgayXemMaket))
                    {
                        item.PTS_NgayXemMaket = Convert.ToDateTime(PTS_NgayXemMaket, new CultureInfo("vi-vn"));
                    }
                    item.PTS_AnhBiaMau = PTS_AnhBiaMau;
                    item.PTS_ThuMuc = PTS_ThuMuc;
                    item.PTS_YeuCauKhachHang = PTS_YeuCauKhachHang;
                    item.PTS_AnhBia = PTS_AnhBia;
                    item.PTS_AnhPhong = PTS_AnhPhong;
                    item.PTS_AnhPhongGhiChu = PTS_AnhPhongGhiChu;
                    item.PTS_AnhBan = PTS_AnhBan;
                    item.PTS_AnhBanQuyCach = PTS_AnhBanQuyCach;
                    item.PTS_AnhBanGhiChu = PTS_AnhBanGhiChu;
                    if (!string.IsNullOrEmpty(PTS_CD3D))
                    {
                        item.PTS_CD3D = Convert.ToBoolean(PTS_CD3D);
                    }

                    if (!string.IsNullOrEmpty(HoanThanh))
                    {
                        item.HoanThanh = Convert.ToBoolean(HoanThanh);
                    }

                    if (!string.IsNullOrEmpty(PTS_HenSanPham))
                    {
                        item.PTS_HenSanPham = Convert.ToDateTime(PTS_HenSanPham, new CultureInfo("vi-vn"));
                    }
                    if (!string.IsNullOrEmpty(PTS_NgayCoSanPham))
                    {
                        item.PTS_NgayCoSanPham = Convert.ToDateTime(PTS_NgayCoSanPham, new CultureInfo("vi-vn"));
                    }
                    if (!string.IsNullOrEmpty(PTS_DaCoSanPham))
                    {
                        item.PTS_DaCoSanPham = Convert.ToBoolean(PTS_DaCoSanPham);
                    }

                    if(!string.IsNullOrEmpty(TongTien))
                    {
                        item.TongTien = Convert.ToDouble(TongTien);
                    }
                    if (!string.IsNullOrEmpty(DatCoc))
                    {
                        item.DatCoc = Convert.ToDouble(DatCoc);
                    }
                    if (!string.IsNullOrEmpty(ConNo))
                    {
                        item.ConNo = Convert.ToDouble(ConNo);
                    }

                    // Huy + Trang Thai
                    if(!string.IsNullOrEmpty(TrangThai))
                    {
                        item.TrangThai = Convert.ToInt32(TrangThai);
                    }
                    if (!string.IsNullOrEmpty(NgayHuy))
                    {
                        item.NgayHuy = Convert.ToDateTime(NgayHuy, new CultureInfo("vi-vn"));
                    }
                    item.LyDoHuy = LyDoHuy;
                    if(!string.IsNullOrEmpty(NhanVienHuy))
                    {
                        item.NhanVienHuy = Convert.ToInt32(NhanVienHuy);
                    }

                    if (IdNull)
                    {
                        item = PhieuDichVuDal.Insert(item);
                        #region log
                        LogDal.log(item, new Log()
                        {
                            Checked = false
                            ,
                            Info =
                                string.Format("{1} thêm mới phiếu dịch vụ: {0}", item.MaStr,
                                              Security.Username)
                            ,
                            NgayTao = DateTime.Now
                            ,
                            Username = Security.Username
                            ,
                            PRowId = item.ID
                            ,
                            PTen = item.MaStr
                            ,
                            RequestIp = Request.UserHostAddress
                            ,
                            RawUrl = refUrl
                            ,
                            LLOG_ID = 1
                            ,
                            Ten = "Thêm"
                        });
                        #endregion
                    }
                    else
                    {
                        item = PhieuDichVuDal.Update(item);
                        #region log
                        LogDal.log(item, new Log()
                        {
                            Checked = false
                            ,
                            Info =
                                string.Format("{1} sửa phiếu dịch vụ: {0}", item.MaStr,
                                              Security.Username)
                            ,
                            NgayTao = DateTime.Now
                            ,
                            Username = Security.Username
                            ,
                            PRowId = item.ID
                            ,
                            PTen = item.MaStr
                            ,
                            RequestIp = Request.UserHostAddress
                            ,
                            RawUrl = refUrl
                            ,
                            LLOG_ID = 2
                            ,
                            Ten = "Sửa"
                        });
                        #endregion
                    }
                    //SearchManager.Add(Ten, item.IndexNoiDung, item.IndexContent, Ten, item.ID.ToString(), item.Url, typeof(SuKien).Name);
                    TimKiemDal.Add(item, item.ID);
                    rendertext(item.ID.ToString());
                }
                break;

                #endregion
            case "saveDuyetAnh":
                #region Lưu nhanh phiếu dịch vụ khi khách hàng duyệt ảnh

                if (Security.IsAuthenticated())
                {
                    var item = PhieuDichVuDal.SelectById(DAL.con(), new Guid(Id));
                    item.PTS_AnhBiaMau = PTS_AnhBiaMau;
                    item.PTS_YeuCauKhachHang = PTS_YeuCauKhachHang;
                    item.PTS_AnhBia = PTS_AnhBia;
                    item.PTS_AnhPhong = PTS_AnhPhong;
                    item.PTS_AnhPhongGhiChu = PTS_AnhPhongGhiChu;
                    item.PTS_AnhBan = PTS_AnhBan;
                    item.PTS_AnhBanQuyCach = PTS_AnhBanQuyCach;
                    item.PTS_AnhBanGhiChu = PTS_AnhBanGhiChu;

                    item.NgayCapNhat = DateTime.Now;
                    item.NguoiCapNhat = Security.UserId;

                    item = PhieuDichVuDal.Update(item);
                    #region log
                    LogDal.log(item, new Log()
                    {
                        Checked = false
                        ,
                        Info =
                            string.Format("{1} sửa phiếu dịch vụ: {0}", item.MaStr,
                                          Security.Username)
                        ,
                        NgayTao = DateTime.Now
                        ,
                        Username = Security.Username
                        ,
                        PRowId = item.ID
                        ,
                        PTen = item.MaStr
                        ,
                        RequestIp = Request.UserHostAddress
                        ,
                        RawUrl = refUrl
                        ,
                        LLOG_ID = 2
                        ,
                        Ten = "Sửa"
                    });
                    #endregion
                    //SearchManager.Add(Ten, item.IndexNoiDung, item.IndexContent, Ten, item.ID.ToString(), item.Url, typeof(SuKien).Name);
                    TimKiemDal.Add(item, item.ID);
                    rendertext(item.ID.ToString());
                }
                break;

                #endregion
            case "remove":
                #region Xóa phiếu dịch vụ

                if (logged)
                {
                    var item = PhieuDichVuDal.SelectById(DAL.con(),new Guid(Id));
                    if (item.NguoiTao != 0)
                    {
                        item.Xoa = true;
                        item.NgayCapNhat = DateTime.Now;
                        item.NguoiCapNhat = Security.UserId;
                        PhieuDichVuDal.Update(item);
                        //SearchManager.Remove(Id);
                        TimKiemDal.DeleteByPRowId(DAL.con(), item.ID);
                        #region log
                        LogDal.log(item, new Log()
                        {
                            Checked = false
                            ,
                            Info =
                                string.Format("{1} xóa phiếu dịch vụ: {0}", item.MaStr,
                                              Security.Username)
                            ,
                            NgayTao = DateTime.Now
                            ,
                            Username = Security.Username
                            ,
                            PRowId = item.ID
                            ,
                            PTen = item.MaStr
                            ,
                            RequestIp = Request.UserHostAddress
                            ,
                            RawUrl = refUrl
                            ,
                            LLOG_ID = 3
                            ,
                            Ten = "Xóa"
                        });
                        #endregion
                        rendertext("1");
                    }
                    else
                    {
                        rendertext("0");
                    }
                }
                break;
                #endregion
            case "removeAdm":
                #region Xóa phiếu dịch vụ

                if (Security.IsAuthenticated())
                {
                    var item = PhieuDichVuDal.SelectById(DAL.con(), new Guid(Id));
                    if (item.NguoiTao == Security.UserId)
                    {
                        item.XoaAdm = true;
                        item.NgayCapNhat = DateTime.Now;
                        item.NguoiCapNhat = Security.UserId;
                        PhieuDichVuDal.Update(item);
                        //SearchManager.Remove(Id);
                        TimKiemDal.DeleteByPRowId(DAL.con(), item.ID);
                        #region log
                        LogDal.log(item, new Log()
                        {
                            Checked = false
                            ,
                            Info =
                                string.Format("{1} xóa phiếu dịch vụ: {0}", item.MaStr,
                                              Security.Username)
                            ,
                            NgayTao = DateTime.Now
                            ,
                            Username = Security.Username
                            ,
                            PRowId = item.ID
                            ,
                            PTen = item.MaStr
                            ,
                            RequestIp = Request.UserHostAddress
                            ,
                            RawUrl = refUrl
                            ,
                            LLOG_ID = 3
                            ,
                            Ten = "Xóa"
                        });
                        #endregion
                        rendertext("1");
                    }
                    else
                    {
                        rendertext("0");
                    }
                }
                break;
                #endregion
            case "restore":
                #region khôi phục phiếu dịch vụ

                if (Security.IsAuthenticated())
                {
                    var item = PhieuDichVuDal.SelectById(DAL.con(), new Guid(Id));
                    if (item.NguoiTao == Security.UserId)
                    {
                        item.Xoa = false;
                        item.XoaAdm = false;
                        item.NgayCapNhat = DateTime.Now;
                        item.NguoiCapNhat = Security.UserId;
                        PhieuDichVuDal.Update(item);
                        #region log
                        LogDal.log(item, new Log()
                        {
                            Checked = false
                            ,
                            Info =
                                string.Format("{1} khôi phục phiếu dịch vụ: {0}", item.MaStr,
                                              Security.Username)
                            ,
                            NgayTao = DateTime.Now
                            ,
                            Username = Security.Username
                            ,
                            PRowId = item.ID
                            ,
                            PTen = item.MaStr
                            ,
                            RequestIp = Request.UserHostAddress
                            ,
                            RawUrl = refUrl
                            ,
                            LLOG_ID = 3
                            ,
                            Ten = "Khôi phục"
                        });
                        #endregion
                        rendertext("1");
                    }
                    else
                    {
                        rendertext("0");
                    }
                }
                break;
                #endregion
            case "search":
                #region search
                var pg = PhieuDichVuDal.TimNhanh(DAL.con(),  q, "10");
                rendertext(JavaScriptConvert.SerializeObject(pg), "text/javascript");
                break;
                #endregion
            default: break;
        }
    }
Ejemplo n.º 24
0
 public bool SuaHoaDonDichVu(PhieuDichVu tt)
 {
     return(dkThue.SuaHoaDonDichVu(tt));
 }
Ejemplo n.º 25
0
 public bool ThemHoaDonDichVu(PhieuDichVu dv)
 {
     return(dkThue.ThemHoaDonDichVu(dv));
 }
Ejemplo n.º 26
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var logged               = Security.IsAuthenticated();
        var Id                   = Request["Id"];
        var IdNull               = string.IsNullOrEmpty(Id);
        var Ma                   = Request["Ma"];
        var KH_ID                = Request["KH_ID"];
        var GDV_ID               = Request["GDV_ID"];
        var TongTien             = Request["TongTien"];
        var ChietKhau            = Request["ChietKhau"];
        var DatCoc               = Request["DatCoc"];
        var ThanhToan            = Request["ThanhToan"];
        var ConNo                = Request["ConNo"];
        var TuVanVien            = Request["TuVanVien"];
        var NgayTuVan            = Request["NgayTuVan"];
        var CHUP_NhanVien        = Request["CHUP_NhanVien"];
        var CHUP_NgayBatDau      = Request["CHUP_NgayBatDau"];
        var CHUP_NgayKetThuc     = Request["CHUP_NgayKetThuc"];
        var CHUP_DiaDiem         = Request["CHUP_DiaDiem"];
        var CHUP_LoaiAlbum       = Request["CHUP_LoaiAlbum"];
        var CHUP_YeuCauKhach     = Request["CHUP_YeuCauKhach"];
        var CHUP_DaChuyenAnh     = Request["CHUP_DaChuyenAnh"];
        var CHUP_DaChuyenAnh_U   = Request["CHUP_DaChuyenAnh_U"];
        var CHUP_NgayChuyenAnh   = Request["CHUP_NgayChuyenAnh"];
        var TD_NhanVien          = Request["TD_NhanVien"];
        var TD_NgayBatDau        = Request["TD_NgayBatDau"];
        var TD_NgayKetThuc       = Request["TD_NgayKetThuc"];
        var TOC_NhanVien         = Request["TOC_NhanVien"];
        var TOC_NgayBatDau       = Request["TOC_NgayBatDau"];
        var TOC_NgayKetThuc      = Request["TOC_NgayKetThuc"];
        var TD_DiaDiem           = Request["TD_DiaDiem"];
        var TD_KhoangCach        = Request["TD_KhoangCach"];
        var TD_PhiDiLai          = Request["TD_PhiDiLai"];
        var TD_KhoanPhaiThu      = Request["TD_KhoanPhaiThu"];
        var PTS_NhanVien         = Request["PTS_NhanVien"];
        var PTS_NhanVienDaNhan   = Request["PTS_NhanVienDaNhan"];
        var PTS_NhanVienDaNhan_U = Request["PTS_NhanVienDaNhan_U"];
        var PTS_NgayXemMaket     = Request["PTS_NgayXemMaket"];
        var PTS_NgayBatDau       = Request["PTS_NgayBatDau"];
        var PTS_NgayKetThuc      = Request["PTS_NgayKetThuc"];
        var PTS_YeuCauKhachHang  = Request["PTS_YeuCauKhachHang"];
        var PTS_HenSanPham       = Request["PTS_HenSanPham"];
        var PTS_DaCoSanPham      = Request["PTS_DaCoSanPham"];
        var PTS_DaCoSanPham_U    = Request["PTS_DaCoSanPham_U"];
        var PTS_NgayCoSanPham    = Request["PTS_NgayCoSanPham"];
        var PTS_NgayLaySanPham   = Request["PTS_NgayLaySanPham"];
        var PTS_AnhPhong         = Request["PTS_AnhPhong"];
        var PTS_AnhPhongGhiChu   = Request["PTS_AnhPhongGhiChu"];
        var PTS_AnhBan           = Request["PTS_AnhBan"];
        var PTS_AnhBanGhiChu     = Request["PTS_AnhBanGhiChu"];
        var PTS_AnhBanQuyCach    = Request["PTS_AnhBanQuyCach"];
        var PTS_AnhBia           = Request["PTS_AnhBia"];
        var PTS_CD3D             = Request["PTS_CD3D"];
        var PTS_CD3D_U           = Request["PTS_CD3D_U"];
        var PTS_AnhBiaMau        = Request["PTS_AnhBiaMau"];
        var PTS_ThuMuc           = Request["PTS_ThuMuc"];
        var HoanThanh            = Request["HoanThanh"];
        var HoanThanh_U          = Request["HoanThanh_U"];

        var Voucher        = Request["Voucher"];
        var Voucher_Ma     = Request["Voucher_Ma"];
        var NguoiTao       = Request["NguoiTao"];
        var NguoiCapNhat   = Request["NguoiCapNhat"];
        var NgayTao        = Request["NgayTao"];
        var NgayCapNhat    = Request["NgayCapNhat"];
        var Xoa            = Request["Xoa"];
        var TrangThai      = Request["TrangThai"];
        var Huy            = Request["Huy"];
        var LyDoHuy        = Request["LyDoHuy"];
        var NgayHuy        = Request["NgayHuy"];
        var TD_NgoaiCanh   = Request["TD_NgoaiCanh"];
        var TD_NgoaiCanh_U = Request["TD_NgoaiCanh_U"];

        var NhanVienHuy = Request["NhanVienHuy"];

        var DuyetEkip       = Request["DuyetEkip"];
        var DeNghiDuyetEkip = Request["DeNghiDuyetEkip"];

        var CHUP_NgayBatDau_Gio  = Request["CHUP_NgayBatDau_Gio"];
        var CHUP_NgayKetThuc_Gio = Request["CHUP_NgayKetThuc_Gio"];
        var TD_NgayBatDau_Gio    = Request["TD_NgayBatDau_Gio"];
        var TD_NgayKetThuc_Gio   = Request["TD_NgayKetThuc_Gio"];
        var TOC_NgayBatDau_Gio   = Request["TOC_NgayBatDau_Gio"];
        var TOC_NgayKetThuc_Gio  = Request["TOC_NgayKetThuc_Gio"];
        var PTS_NgayBatDau_Gio   = Request["PTS_NgayBatDau_Gio"];
        var PTS_NgayKetThuc_Gio  = Request["PTS_NgayKetThuc_Gio"];


        CHUP_DaChuyenAnh   = !string.IsNullOrEmpty(CHUP_DaChuyenAnh_U) ? string.IsNullOrEmpty(CHUP_DaChuyenAnh) ? "false" : "true" : "";
        PTS_NhanVienDaNhan = !string.IsNullOrEmpty(PTS_NhanVienDaNhan_U) ? string.IsNullOrEmpty(PTS_NhanVienDaNhan) ? "false" : "true" : "";
        PTS_CD3D           = !string.IsNullOrEmpty(PTS_CD3D_U) ? string.IsNullOrEmpty(PTS_CD3D) ? "false" : "true" : "";
        PTS_DaCoSanPham    = !string.IsNullOrEmpty(PTS_DaCoSanPham_U) ?  string.IsNullOrEmpty(PTS_DaCoSanPham) ? "false" : "true" : "";
        Huy          = string.IsNullOrEmpty(Huy) ? "false" : "true";
        HoanThanh    = !string.IsNullOrEmpty(HoanThanh_U) ? string.IsNullOrEmpty(HoanThanh) ? "false" : "true" : "";
        DuyetEkip    = string.IsNullOrEmpty(DuyetEkip) ? "false" : "true";
        TD_NgoaiCanh = !string.IsNullOrEmpty(TD_NgoaiCanh_U) ? string.IsNullOrEmpty(TD_NgoaiCanh) ? "false" : "true" : "";

        var refUrl = Request["refUrl"];

        if (!string.IsNullOrEmpty(refUrl))
        {
            refUrl = Server.UrlDecode(refUrl);
        }
        var q = Request["q"];

        switch (subAct)
        {
        case "save":
            #region Thêm phiếu dịch vụ

            if (Security.IsAuthenticated())
            {
                var item = PhieuDichVuDal.SelectById(DAL.con(), new Guid(Id));
                IdNull  = item.ID == Guid.Empty;
                item.ID = new Guid(Id);
                if (IdNull)
                {
                    item = new PhieuDichVu
                    {
                        ID       = new Guid(Id),
                        NgayTao  = DateTime.Now,
                        NguoiTao = Security.UserId
                    };
                }
                item.NguoiCapNhat = Security.UserId;
                item.NgayCapNhat  = DateTime.Now;

                if (Convert.ToBoolean(DuyetEkip))
                {
                    if (!item.DuyetEkip)
                    {
                        item.NgayDuyetEkip = DateTime.Now;
                        item.NguoiDuyet    = Security.UserId;
                    }
                }
                if (!string.IsNullOrEmpty(TD_NgoaiCanh))
                {
                    item.TD_NgoaiCanh = Convert.ToBoolean(TD_NgoaiCanh);
                }
                if (!string.IsNullOrEmpty(DeNghiDuyetEkip))
                {
                    item.DuyetEkip = Convert.ToBoolean(DuyetEkip);
                }
                if (!string.IsNullOrEmpty(Ma))
                {
                    item.Ma = Convert.ToInt32(Ma);
                }
                if (!string.IsNullOrEmpty(KH_ID))
                {
                    item.KH_ID = new Guid(KH_ID);
                }
                if (!string.IsNullOrEmpty(NgayTuVan))
                {
                    item.NgayTuVan = Convert.ToDateTime(NgayTuVan, new CultureInfo("vi-vn"));
                }

                if (!string.IsNullOrEmpty(TuVanVien))
                {
                    item.TuVanVien = Convert.ToInt32(TuVanVien);
                }
                if (!string.IsNullOrEmpty(GDV_ID))
                {
                    item.GDV_ID = new Guid(GDV_ID);
                }

                // Chup anh
                if (!string.IsNullOrEmpty(CHUP_NhanVien))
                {
                    item.CHUP_NhanVien = Convert.ToInt32(CHUP_NhanVien);
                }

                if (!string.IsNullOrEmpty(CHUP_NgayBatDau) && !string.IsNullOrEmpty(CHUP_NgayBatDau_Gio))
                {
                    item.CHUP_NgayBatDau = Convert.ToDateTime(string.Format("{0} {1}", CHUP_NgayBatDau, CHUP_NgayBatDau_Gio), new CultureInfo("vi-vn"));
                }
                if (!string.IsNullOrEmpty(CHUP_NgayBatDau) && !string.IsNullOrEmpty(CHUP_NgayKetThuc_Gio))
                {
                    item.CHUP_NgayKetThuc = Convert.ToDateTime(string.Format("{0} {1}", CHUP_NgayBatDau, CHUP_NgayKetThuc_Gio), new CultureInfo("vi-vn"));
                }
                item.CHUP_DiaDiem     = CHUP_DiaDiem;
                item.CHUP_LoaiAlbum   = CHUP_LoaiAlbum;
                item.CHUP_YeuCauKhach = CHUP_YeuCauKhach;
                if (!string.IsNullOrEmpty(CHUP_DaChuyenAnh))
                {
                    item.CHUP_DaChuyenAnh = Convert.ToBoolean(CHUP_DaChuyenAnh);
                }
                item.Huy = Convert.ToBoolean(Huy);
                // Trang diem
                if (!string.IsNullOrEmpty(TD_NhanVien))
                {
                    item.TD_NhanVien = Convert.ToInt32(TD_NhanVien);
                }
                if (!string.IsNullOrEmpty(TD_NgayBatDau) && !string.IsNullOrEmpty(TD_NgayBatDau_Gio))
                {
                    item.TD_NgayBatDau = Convert.ToDateTime(string.Format("{0} {1}", TD_NgayBatDau, TD_NgayBatDau_Gio), new CultureInfo("vi-vn"));
                }
                if (!string.IsNullOrEmpty(TD_NgayBatDau) && !string.IsNullOrEmpty(TD_NgayKetThuc_Gio))
                {
                    item.TD_NgayKetThuc = Convert.ToDateTime(string.Format("{0} {1}", TD_NgayBatDau, TD_NgayKetThuc_Gio), new CultureInfo("vi-vn"));
                }
                item.TD_DiaDiem = TD_DiaDiem;
                if (!string.IsNullOrEmpty(TD_KhoangCach))
                {
                    item.TD_KhoangCach = Convert.ToInt32(TD_KhoangCach);
                }
                if (!string.IsNullOrEmpty(TD_PhiDiLai))
                {
                    item.TD_PhiDiLai = Convert.ToDouble(TD_PhiDiLai);
                }
                if (!string.IsNullOrEmpty(TD_KhoanPhaiThu))
                {
                    item.TD_KhoanPhaiThu = Convert.ToDouble(TD_KhoanPhaiThu);
                }

                // Toc
                if (!string.IsNullOrEmpty(TOC_NhanVien))
                {
                    item.TOC_NhanVien = Convert.ToInt32(TOC_NhanVien);
                }
                if (!string.IsNullOrEmpty(TOC_NgayBatDau) && !string.IsNullOrEmpty(TOC_NgayBatDau_Gio))
                {
                    item.TOC_NgayBatDau = Convert.ToDateTime(string.Format("{0} {1}", TOC_NgayBatDau, TOC_NgayBatDau_Gio), new CultureInfo("vi-vn"));
                }
                if (!string.IsNullOrEmpty(TOC_NgayBatDau) && !string.IsNullOrEmpty(TOC_NgayKetThuc_Gio))
                {
                    item.TOC_NgayKetThuc = Convert.ToDateTime(string.Format("{0} {1}", TOC_NgayBatDau, TOC_NgayKetThuc_Gio), new CultureInfo("vi-vn"));
                }

                // Photoshop
                if (!string.IsNullOrEmpty(PTS_NhanVien))
                {
                    item.PTS_NhanVien = Convert.ToInt32(PTS_NhanVien);
                }
                if (!string.IsNullOrEmpty(PTS_NgayBatDau))
                {
                    item.PTS_NgayBatDau = Convert.ToDateTime(PTS_NgayBatDau, new CultureInfo("vi-vn"));
                }
                if (!string.IsNullOrEmpty(PTS_NgayLaySanPham))
                {
                    item.PTS_NgayLaySanPham = Convert.ToDateTime(PTS_NgayLaySanPham, new CultureInfo("vi-vn"));
                }
                if (!string.IsNullOrEmpty(PTS_NgayKetThuc))
                {
                    item.PTS_NgayKetThuc = Convert.ToDateTime(PTS_NgayKetThuc, new CultureInfo("vi-vn"));
                }
                if (!string.IsNullOrEmpty(PTS_NhanVienDaNhan))
                {
                    item.PTS_NhanVienDaNhan = Convert.ToBoolean(PTS_NhanVienDaNhan);
                }

                if (!string.IsNullOrEmpty(PTS_NgayXemMaket))
                {
                    item.PTS_NgayXemMaket = Convert.ToDateTime(PTS_NgayXemMaket, new CultureInfo("vi-vn"));
                }
                item.PTS_AnhBiaMau       = PTS_AnhBiaMau;
                item.PTS_ThuMuc          = PTS_ThuMuc;
                item.PTS_YeuCauKhachHang = PTS_YeuCauKhachHang;
                item.PTS_AnhBia          = PTS_AnhBia;
                item.PTS_AnhPhong        = PTS_AnhPhong;
                item.PTS_AnhPhongGhiChu  = PTS_AnhPhongGhiChu;
                item.PTS_AnhBan          = PTS_AnhBan;
                item.PTS_AnhBanQuyCach   = PTS_AnhBanQuyCach;
                item.PTS_AnhBanGhiChu    = PTS_AnhBanGhiChu;
                if (!string.IsNullOrEmpty(PTS_CD3D))
                {
                    item.PTS_CD3D = Convert.ToBoolean(PTS_CD3D);
                }

                if (!string.IsNullOrEmpty(HoanThanh))
                {
                    item.HoanThanh = Convert.ToBoolean(HoanThanh);
                }

                if (!string.IsNullOrEmpty(PTS_HenSanPham))
                {
                    item.PTS_HenSanPham = Convert.ToDateTime(PTS_HenSanPham, new CultureInfo("vi-vn"));
                }
                if (!string.IsNullOrEmpty(PTS_NgayCoSanPham))
                {
                    item.PTS_NgayCoSanPham = Convert.ToDateTime(PTS_NgayCoSanPham, new CultureInfo("vi-vn"));
                }
                if (!string.IsNullOrEmpty(PTS_DaCoSanPham))
                {
                    item.PTS_DaCoSanPham = Convert.ToBoolean(PTS_DaCoSanPham);
                }

                if (!string.IsNullOrEmpty(TongTien))
                {
                    item.TongTien = Convert.ToDouble(TongTien);
                }
                if (!string.IsNullOrEmpty(DatCoc))
                {
                    item.DatCoc = Convert.ToDouble(DatCoc);
                }
                if (!string.IsNullOrEmpty(ConNo))
                {
                    item.ConNo = Convert.ToDouble(ConNo);
                }

                // Huy + Trang Thai
                if (!string.IsNullOrEmpty(TrangThai))
                {
                    item.TrangThai = Convert.ToInt32(TrangThai);
                }
                if (!string.IsNullOrEmpty(NgayHuy))
                {
                    item.NgayHuy = Convert.ToDateTime(NgayHuy, new CultureInfo("vi-vn"));
                }
                item.LyDoHuy = LyDoHuy;
                if (!string.IsNullOrEmpty(NhanVienHuy))
                {
                    item.NhanVienHuy = Convert.ToInt32(NhanVienHuy);
                }


                if (IdNull)
                {
                    item = PhieuDichVuDal.Insert(item);
                    #region log
                    LogDal.log(item, new Log()
                    {
                        Checked = false
                        ,
                        Info =
                            string.Format("{1} thêm mới phiếu dịch vụ: {0}", item.MaStr,
                                          Security.Username)
                        ,
                        NgayTao = DateTime.Now
                        ,
                        Username = Security.Username
                        ,
                        PRowId = item.ID
                        ,
                        PTen = item.MaStr
                        ,
                        RequestIp = Request.UserHostAddress
                        ,
                        RawUrl = refUrl
                        ,
                        LLOG_ID = 1
                        ,
                        Ten = "Thêm"
                    });
                    #endregion
                }
                else
                {
                    item = PhieuDichVuDal.Update(item);
                    #region log
                    LogDal.log(item, new Log()
                    {
                        Checked = false
                        ,
                        Info =
                            string.Format("{1} sửa phiếu dịch vụ: {0}", item.MaStr,
                                          Security.Username)
                        ,
                        NgayTao = DateTime.Now
                        ,
                        Username = Security.Username
                        ,
                        PRowId = item.ID
                        ,
                        PTen = item.MaStr
                        ,
                        RequestIp = Request.UserHostAddress
                        ,
                        RawUrl = refUrl
                        ,
                        LLOG_ID = 2
                        ,
                        Ten = "Sửa"
                    });
                    #endregion
                }
                //SearchManager.Add(Ten, item.IndexNoiDung, item.IndexContent, Ten, item.ID.ToString(), item.Url, typeof(SuKien).Name);
                TimKiemDal.Add(item, item.ID);
                rendertext(item.ID.ToString());
            }
            break;

            #endregion
        case "saveDuyetAnh":
            #region Lưu nhanh phiếu dịch vụ khi khách hàng duyệt ảnh

            if (Security.IsAuthenticated())
            {
                var item = PhieuDichVuDal.SelectById(DAL.con(), new Guid(Id));
                item.PTS_AnhBiaMau       = PTS_AnhBiaMau;
                item.PTS_YeuCauKhachHang = PTS_YeuCauKhachHang;
                item.PTS_AnhBia          = PTS_AnhBia;
                item.PTS_AnhPhong        = PTS_AnhPhong;
                item.PTS_AnhPhongGhiChu  = PTS_AnhPhongGhiChu;
                item.PTS_AnhBan          = PTS_AnhBan;
                item.PTS_AnhBanQuyCach   = PTS_AnhBanQuyCach;
                item.PTS_AnhBanGhiChu    = PTS_AnhBanGhiChu;

                item.NgayCapNhat  = DateTime.Now;
                item.NguoiCapNhat = Security.UserId;

                item = PhieuDichVuDal.Update(item);
                #region log
                LogDal.log(item, new Log()
                {
                    Checked = false
                    ,
                    Info =
                        string.Format("{1} sửa phiếu dịch vụ: {0}", item.MaStr,
                                      Security.Username)
                    ,
                    NgayTao = DateTime.Now
                    ,
                    Username = Security.Username
                    ,
                    PRowId = item.ID
                    ,
                    PTen = item.MaStr
                    ,
                    RequestIp = Request.UserHostAddress
                    ,
                    RawUrl = refUrl
                    ,
                    LLOG_ID = 2
                    ,
                    Ten = "Sửa"
                });
                #endregion
                //SearchManager.Add(Ten, item.IndexNoiDung, item.IndexContent, Ten, item.ID.ToString(), item.Url, typeof(SuKien).Name);
                TimKiemDal.Add(item, item.ID);
                rendertext(item.ID.ToString());
            }
            break;

            #endregion
        case "remove":
            #region Xóa phiếu dịch vụ

            if (logged)
            {
                var item = PhieuDichVuDal.SelectById(DAL.con(), new Guid(Id));
                if (item.NguoiTao != 0)
                {
                    item.Xoa          = true;
                    item.NgayCapNhat  = DateTime.Now;
                    item.NguoiCapNhat = Security.UserId;
                    PhieuDichVuDal.Update(item);
                    //SearchManager.Remove(Id);
                    TimKiemDal.DeleteByPRowId(DAL.con(), item.ID);
                    #region log
                    LogDal.log(item, new Log()
                    {
                        Checked = false
                        ,
                        Info =
                            string.Format("{1} xóa phiếu dịch vụ: {0}", item.MaStr,
                                          Security.Username)
                        ,
                        NgayTao = DateTime.Now
                        ,
                        Username = Security.Username
                        ,
                        PRowId = item.ID
                        ,
                        PTen = item.MaStr
                        ,
                        RequestIp = Request.UserHostAddress
                        ,
                        RawUrl = refUrl
                        ,
                        LLOG_ID = 3
                        ,
                        Ten = "Xóa"
                    });
                    #endregion
                    rendertext("1");
                }
                else
                {
                    rendertext("0");
                }
            }
            break;

            #endregion
        case "removeAdm":
            #region Xóa phiếu dịch vụ

            if (Security.IsAuthenticated())
            {
                var item = PhieuDichVuDal.SelectById(DAL.con(), new Guid(Id));
                if (item.NguoiTao == Security.UserId)
                {
                    item.XoaAdm       = true;
                    item.NgayCapNhat  = DateTime.Now;
                    item.NguoiCapNhat = Security.UserId;
                    PhieuDichVuDal.Update(item);
                    //SearchManager.Remove(Id);
                    TimKiemDal.DeleteByPRowId(DAL.con(), item.ID);
                    #region log
                    LogDal.log(item, new Log()
                    {
                        Checked = false
                        ,
                        Info =
                            string.Format("{1} xóa phiếu dịch vụ: {0}", item.MaStr,
                                          Security.Username)
                        ,
                        NgayTao = DateTime.Now
                        ,
                        Username = Security.Username
                        ,
                        PRowId = item.ID
                        ,
                        PTen = item.MaStr
                        ,
                        RequestIp = Request.UserHostAddress
                        ,
                        RawUrl = refUrl
                        ,
                        LLOG_ID = 3
                        ,
                        Ten = "Xóa"
                    });
                    #endregion
                    rendertext("1");
                }
                else
                {
                    rendertext("0");
                }
            }
            break;

            #endregion
        case "restore":
            #region khôi phục phiếu dịch vụ

            if (Security.IsAuthenticated())
            {
                var item = PhieuDichVuDal.SelectById(DAL.con(), new Guid(Id));
                if (item.NguoiTao == Security.UserId)
                {
                    item.Xoa          = false;
                    item.XoaAdm       = false;
                    item.NgayCapNhat  = DateTime.Now;
                    item.NguoiCapNhat = Security.UserId;
                    PhieuDichVuDal.Update(item);
                    #region log
                    LogDal.log(item, new Log()
                    {
                        Checked = false
                        ,
                        Info =
                            string.Format("{1} khôi phục phiếu dịch vụ: {0}", item.MaStr,
                                          Security.Username)
                        ,
                        NgayTao = DateTime.Now
                        ,
                        Username = Security.Username
                        ,
                        PRowId = item.ID
                        ,
                        PTen = item.MaStr
                        ,
                        RequestIp = Request.UserHostAddress
                        ,
                        RawUrl = refUrl
                        ,
                        LLOG_ID = 3
                        ,
                        Ten = "Khôi phục"
                    });
                    #endregion
                    rendertext("1");
                }
                else
                {
                    rendertext("0");
                }
            }
            break;

            #endregion
        case "search":
            #region search
            var pg = PhieuDichVuDal.TimNhanh(DAL.con(), q, "10");
            rendertext(JavaScriptConvert.SerializeObject(pg), "text/javascript");
            break;

            #endregion
        default: break;
        }
    }
Ejemplo n.º 27
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var id = Request["ID"];

        if (string.IsNullOrEmpty(id))
        {
            id = PdvId;
        }
        using (var con = DAL.con())
        {
            var selected = DuyetAnhDal.SelectByPdvId(con, id);

            var pdv = PhieuDichVuDal.SelectById(con, new Guid(id));
            Item = pdv;
            var listBaiHat = BaiHatDal.SelectByPdvId(con, id);
            var pdvDic     = pdv.PTS_ThuMuc;
            if (string.IsNullOrEmpty(pdvDic))
            {
                pdvDic = ImgPath;
            }
            var dic = new DirectoryInfo(pdvDic);


            var targetDic = Lib.ImgDomain() + pdvDic;

            var wc = new WebClient();
            var filesInTargetDic = wc.DownloadString(targetDic);
            if (string.IsNullOrEmpty(filesInTargetDic))
            {
            }
            else
            {
                var files = filesInTargetDic.Split(new char[] { '|' });


                var list = (from f in files
                            where f.Length > 1
                            select new DuyetAnh()
                {
                    Ten = f
                    ,
                    FullName = string.Format("{0}{1}", targetDic, f)
                }).ToList();

                foreach (var item in selected)
                {
                    var items = list.FirstOrDefault(x => x.Ten.ToLower() == item.Ten.ToLower());
                    if (items == null)
                    {
                        continue;
                    }
                    items.ID       = item.ID;
                    items.Selected = true;
                    items.GhiChu   = item.GhiChu;
                    items.ThuTu    = item.ThuTu;
                }
                View.DuyetAnhs   = list.Where(x => x.Selected).ToList();
                View.DanhSachAnh = list;
                View.Item        = pdv;
                View.ListBaiHat  = listBaiHat;
            }
        }
    }