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"; } }
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 logged = Security.IsAuthenticated(); var Id = Request["Id"]; var PDVDV_Id = Request["PDVDV_Id"]; var IdNull = string.IsNullOrEmpty(Id); var PDV_ID = Request["DUYETANH_PDV_ID"]; var DUYETANH_ID = Request["DUYETANH_ID"]; var ThuTu = Request["ThuTu"]; var Ten = Request["Ten"]; var GhiChu = Request["GhiChu"]; var refUrl = Request["refUrl"]; if (!string.IsNullOrEmpty(refUrl)) { refUrl = Server.UrlDecode(refUrl); } switch (subAct) { case "save": #region save Duyet anh if (!string.IsNullOrEmpty(PDV_ID)) { var item = new DuyetAnh(); item.ID = Guid.NewGuid(); item.PDV_ID = new Guid(PDV_ID); item.NgayTao = DateTime.Now; item.NhanVien = Security.UserId; item.Ten = Ten; item.GhiChu = GhiChu; if (!string.IsNullOrEmpty(ThuTu)) { item.ThuTu = Convert.ToInt32(ThuTu); } item = DuyetAnhDal.Insert(item); ItemEdit.Item = item; ItemEdit.Visible = true; } break; #endregion case "saveQuick": #region save Duyet anh if (!string.IsNullOrEmpty(PDV_ID)) { var item = new DuyetAnh(); item.ID = Guid.NewGuid(); item.PDV_ID = new Guid(PDV_ID); item.NgayTao = DateTime.Now; item.NhanVien = Security.UserId; item.Ten = Ten; item.GhiChu = GhiChu; if (!string.IsNullOrEmpty(ThuTu)) { item.ThuTu = Convert.ToInt32(ThuTu); } item = DuyetAnhDal.Insert(item); rendertext(item.ID.ToString()); } break; #endregion case "update": #region update Goi dich vu chi tiet if (!string.IsNullOrEmpty(DUYETANH_ID)) { var item = DuyetAnhDal.SelectById(new Guid(DUYETANH_ID)); if (!string.IsNullOrEmpty(ThuTu)) { item.ThuTu = Convert.ToInt32(ThuTu); } if (!string.IsNullOrEmpty(ThuTu)) { item.ThuTu = Convert.ToInt32(ThuTu); } item.Ten = Ten; item.GhiChu = GhiChu; item = DuyetAnhDal.Update(item); rendertext(item.ID.ToString()); } break; #endregion case "remove": #region Xóa Goi dich vu chi tiet if (logged && !IdNull) { var item = DuyetAnhDal.SelectById(new Guid(Id)); if (item.NhanVien == Security.UserId) { DuyetAnhDal.DeleteById(new Guid(Id)); TimKiemDal.DeleteByPRowId(DAL.con(), item.ID); #region log LogDal.log(item, new Log() { Checked = false , Info = string.Format("{1} xóa gói ảnh {0}", item.Ten, Security.Username) , NgayTao = DateTime.Now , Username = Security.Username , PRowId = item.ID , PTen = item.Ten , RequestIp = Request.UserHostAddress , RawUrl = refUrl , LLOG_ID = 3 , Ten = "Xóa" }); #endregion rendertext("1"); } else { rendertext("0"); } } break; #endregion case "removeByTen": #region Xóa by Ten if (logged && !string.IsNullOrEmpty(PDV_ID) && !string.IsNullOrEmpty(Ten)) { var item = DuyetAnhDal.SelectByPdvIdTen(DAL.con(), PDV_ID, Ten).FirstOrDefault(); if (item == null) { rendertext("0"); } if (item.NhanVien == Security.UserId) { DuyetAnhDal.DeleteById(item.ID); TimKiemDal.DeleteByPRowId(DAL.con(), item.ID); #region log LogDal.log(item, new Log() { Checked = false , Info = string.Format("{1} xóa ảnh của phiếu dịch vụ {0}", item.Ten, Security.Username) , NgayTao = DateTime.Now , Username = Security.Username , PRowId = item.ID , PTen = item.Ten , RequestIp = Request.UserHostAddress , RawUrl = refUrl , LLOG_ID = 3 , Ten = "Xóa" }); #endregion rendertext("1"); } else { rendertext("0"); } } break; #endregion default: break; } }
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; } } }