Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var q    = Request["q"];
        var size = Request["size"];

        if (string.IsNullOrEmpty(size))
        {
            size = "10";
        }
        var trangThai = Request["TrangThai"];

        Ngay = Request["Ngay"];
        var url     = string.Format("?q={0}&size={1}&TrangThai={2}&Ngay={3}&", q, size, trangThai, Ngay) + "{1}={0}";
        var tuNgay  = "";
        var denNgay = "";

        if (!string.IsNullOrEmpty(Ngay))
        {
            Ngay = Server.UrlDecode(Ngay);
            var d = Convert.ToDateTime(Ngay, new CultureInfo("Vi-vn"));
            tuNgay  = new DateTime(d.Year, d.Month, d.Day).AddDays(-1).ToString("yyyy-MM-dd");
            denNgay = new DateTime(d.Year, d.Month, d.Day).AddDays(1).ToString("yyyy-MM-dd");
        }

        using (var con = DAL.con())
        {
            var pg =
                PhieuDichVuDal.pagerTdToc(con, url, false, "PDV_Ma desc", q, Convert.ToInt32(size), trangThai
                                          , Security.UserId.ToString(), tuNgay, denNgay);
            List.List = pg.List;
            paging    = pg.Paging;
        }
    }
Beispiel #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();
            }
            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";
        }
    }
Beispiel #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var d = DateTime.Now;

        var dauThang   = new DateTime(d.Year, d.Month, 1).AddMonths(-1);
        var cuoiThang  = new DateTime(d.Year, d.Month, 1).AddMonths(1);
        var tuNgayStr  = Request["TuNgay"];
        var denNgayStr = Request["DenNgay"];

        if (string.IsNullOrEmpty(tuNgayStr))
        {
            tuNgayStr = dauThang.ToString("dd/MM/yyyy");
        }
        if (string.IsNullOrEmpty(denNgayStr))
        {
            denNgayStr = cuoiThang.ToString("dd/MM/yyyy");
        }
        var nhanVien_Id = Request["NhanVien_Id"];
        var tuNgay      = Convert.ToDateTime(tuNgayStr, new CultureInfo("Vi-vn"));
        var denNgay     = Convert.ToDateTime(denNgayStr, new CultureInfo("Vi-vn"));

        using (var con = DAL.con())
        {
            var pg = PhieuDichVuDal.pagerBaoCao(con, string.Empty, false, "PDV_Ma desc", string.Empty, 20, tuNgay.ToString("yyyy-MM-dd"),
                                                denNgay.ToString("yyyy-MM-dd"));
            List.List = pg.List;
        }
    }
    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;;
        }
    }
Beispiel #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var id    = Request["ID"];
        var pdvId = Request["PDV_ID"];
        var list  = new List <PhieuXuatNhapSanPhamChiTiet>();

        using (var con = DAL.con())
        {
            if (string.IsNullOrEmpty(id))
            {
                Item    = PhieuXuatNhapSanPhamDal.SelectDraff(con);
                Item.Ma = Item.Ma == 0 ? 1 : Item.Ma + 1;
                Item.ID = Guid.NewGuid();
                if (!string.IsNullOrEmpty(pdvId))
                {
                    var pdv = PhieuDichVuDal.SelectById(con, new Guid(pdvId));
                    Item.PDV_ID = pdv.ID;
                    Item.PDV_Ma = pdv.Ma;
                }
            }
            else
            {
                Item = PhieuXuatNhapSanPhamDal.SelectById(con, new Guid(id));
                list = PhieuXuatNhapSanPhamChiTietDal.SelectByPxnSpId(con, id);
            }
            Add.List = list;
            Add.Item = Item;;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        var q = Request["q"];

        using (var con = DAL.con())
        {
            var pg =
                PhieuDichVuDal.pagerXoa(con, string.Empty, false, "PDV_Ma desc", q, 20);
            List.List = pg.List;
            paging    = pg.Paging;
        }
    }
Beispiel #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var id = Request["ID"];

        using (var con = DAL.con())
        {
            Item = PhieuXuatNhapSanPhamDal.SelectById(con, new Guid(id));
            var phieuDichVuItem = PhieuDichVuDal.SelectById(con, Item.PDV_ID);
            var khachHangItem   = KhachHangDal.SelectById(phieuDichVuItem.KH_ID, con);

            Print.Item  = Item;
            Print.Khach = khachHangItem;

            var logoStr = DanhMucDal.SelectByMa("BAOCAO-HEADER-THUCHI", con).Description;
            Print.LogoStr = logoStr;
        }
    }
Beispiel #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var size = Request["size"];

        if (string.IsNullOrEmpty(size))
        {
            size = "10";
        }
        Ngay = Request["Ngay"];
        var url = string.Format("?size={0}&", size) + "{1}={0}";

        using (var con = DAL.con())
        {
            var pg =
                PhieuDichVuDal.pagerDuyetEkip(con, url, false, "PDV_Ma desc", Convert.ToInt32(size), "1");
            ListDeNghiDaDuyet.List = pg.List;
            paging = pg.Paging;
        }
    }
Beispiel #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var q       = Request["q"];
        var tuNgay  = "";
        var denNgay = "";
        var d       = DateTime.Now;

        tuNgay  = new DateTime(d.Year, d.Month, d.Day).AddDays(-10).ToString("yyyy-MM-dd");
        denNgay = new DateTime(d.Year, d.Month, d.Day).AddDays(1).ToString("yyyy-MM-dd");

        using (var con = DAL.con())
        {
            var pg =
                PhieuDichVuDal.pagerByNhanVienNgay(con, string.Empty, false, "PDV_Ma desc", q, 10, null
                                                   , null, tuNgay, denNgay);
            List.List = pg.List;
            paging    = pg.Paging;
        }
    }
Beispiel #10
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;
        }
    }
Beispiel #11
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;;
        }
    }
Beispiel #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var id    = Request["ID"];
        var khId  = Request["KH_ID"];
        var pdvId = Request["PDV_ID"];
        var ctvId = Request["CTV_ID"];
        var pgvId = Request["PGV_ID"];
        var pbhId = Request["PBH_ID"];

        using (var con = DAL.con())
        {
            if (string.IsNullOrEmpty(id))
            {
                Item = ThuChiDal.SelectByDraff(con, true);
                if (khId != null && khId.Length >= 36)
                {
                    khId = khId.Substring(khId.LastIndexOf(',') + 1);
                    var kh = KhachHangDal.SelectById(new Guid(khId), con);
                    Item.P_Ten = kh.Ten;
                    Item.P_ID  = kh.ID;
                }


                if (pdvId != null && pdvId.Length >= 36)
                {
                    pdvId = pdvId.Substring(pdvId.LastIndexOf(',') + 1);
                    var pdv = PhieuDichVuDal.SelectById(con, new Guid(pdvId));
                    Item.PDV_ID = pdv.ID;
                    Item.PDV_Ma = pdv.Ma;
                    var kh = KhachHangDal.SelectById(pdv.KH_ID, con);
                    Item.P_Ten = kh.Ten;
                    Item.P_ID  = kh.ID;
                }

                if (ctvId != null && ctvId.Length >= 36)
                {
                    ctvId = ctvId.Substring(ctvId.LastIndexOf(',') + 1);
                    var ctv = ChoThueVayDal.SelectById(con, new Guid(ctvId));
                    Item.CTV_ID = ctv.ID;
                    Item.CTV_Ma = ctv.Ma;
                    var kh = KhachHangDal.SelectById(ctv.KH_ID, con);
                    Item.P_Ten = kh.Ten;
                    Item.P_ID  = kh.ID;
                }

                if (pgvId != null && pgvId.Length >= 36)
                {
                    pgvId = pgvId.Substring(pgvId.LastIndexOf(',') + 1);
                    var pgv = PhieuGiatVayDal.SelectById(con, new Guid(pgvId));
                    Item.PGV_ID = pgv.ID;
                    Item.PGV_Ma = pgv.Ma;
                }
                if (pbhId != null && pbhId.Length >= 36)
                {
                    pbhId = pbhId.Substring(pgvId.LastIndexOf(',') + 1);
                    var pbh = PhieuBaoHongDal.SelectById(con, new Guid(pbhId));
                    Item.PBH_ID = pbh.ID;
                    Item.PBH_Ma = pbh.Ma;
                }
            }
            else
            {
                Item = ThuChiDal.SelectById(con, new Guid(id));
            }
            var logoStr = DanhMucDal.SelectByMa("BAOCAO-HEADER-THUCHI", con).Description;
            InPhieuChi.LogoStr = logoStr;
            var listLoai = DanhMucDal.SelectByLDMMa(con, "NDTC-CHI");
            InPhieuChi.ListLoai = listLoai;
            InPhieuChi.Item     = Item;
        }
    }
Beispiel #13
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;
            }
        }
    }
    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;
        }
    }