public void ActionAdd(ModDT_KyModel model) { if (model.RecordID > 0) { item = ModDT_KyService.Instance.GetByID(model.RecordID); // khoi tao gia tri mac dinh khi update model.DaChotKy = item.Activity ? (int)EnumValue.Activity.FALSE : (int)EnumValue.Activity.TRUE; } else { // Kiểm tra xem có kỳ doanh thu nào đang tồn tại không. Nếu có thì không cho phép thêm var objCheck = ModDT_KyService.Instance.CreateQuery().Where(o => o.Activity == true).ToSingle(); if (objCheck != null) { CPViewPage.SetMessage("Tồn tại một kỳ doanh thu đang hoạt động. Yêu cầu chốt kỳ doanh thu để có thể thêm mới"); CPViewPage.Response.Redirect(CPViewPage.Request.RawUrl.Replace("Add.aspx", "Index.aspx")); return; } item = new ModDT_KyEntity(); // khoi tao gia tri mac dinh khi insert item.Activity = CPViewPage.UserPermissions.Approve; item.CreateDate = DateTime.Now; model.DaChotKy = (int)EnumValue.Activity.FALSE; } ViewBag.Data = item; ViewBag.Model = model; }
public override void ActionDelete(int[] arrID) { if (CheckPermissions && !CPViewPage.UserPermissions.Delete) { //thong bao CPViewPage.Message.MessageType = Message.MessageTypeEnum.Error; CPViewPage.Message.ListMessage.Add("Bạn không có quyền xóa."); return; } var list = new List <int>(); GetMenuIDChildForDelete(ref list, arrID); if (list != null && list.Count > 0) { //var sWhere = "[MenuID] IN (" + Core.Global.Array.ToString(list.ToArray()) + ")"; ////xoa news //if (ModNewsService.Instance.Exists(sWhere)) //{ // CPViewPage.Alert("Danh mục bạn xóa còn chứa Bài viết. Hãy xóa hết Bài viết trong chuyên mục muốn xóa trước."); // return; //} //xoa menu string sWhere = "[MenuID] IN (" + Core.Global.Array.ToString(list.ToArray()) + ")"; WebMenuService.Instance.DeleteAsync(sWhere); } //thong bao CPViewPage.SetMessage("Đã xóa thành công."); CPViewPage.RefreshPage(); }
public override void ActionDelete(int[] arrID) { List <int> list = new List <int>(); GetMenuIDChildForDelete(ref list, arrID); if (list != null && list.Count > 0) { string sWhere = "[ID] IN (" + VSW.Core.Global.Array.ToString(list.ToArray()) + ")"; //xoa menu WebMenuService.Instance.Delete(sWhere); sWhere = "[MenuID] IN (" + VSW.Core.Global.Array.ToString(list.ToArray()) + ")"; //xoa news ModNewsService.Instance.Delete(sWhere); //xoa adv ModAdvService.Instance.Delete(sWhere); } //thong bao CPViewPage.SetMessage("Đã xóa thành công."); CPViewPage.RefreshPage(); }
public override void ActionDelete(int[] arrID) { if (CheckPermissions && !CPViewPage.UserPermissions.Delete) { //thong bao CPViewPage.Message.MessageType = Message.MessageTypeEnum.Error; CPViewPage.Message.ListMessage.Add("Quyền hạn chế."); return; } DataService.Delete("[ID] IN (" + HL.Core.Global.Array.ToString(arrID) + ")"); var query = ModDauMoiUCSCService.Instance.CreateQuery().WhereIn(o => o.HSThanhVienUCSCID, HL.Core.Global.Array.ToString(arrID)).ToSingle(); if (query != null) { var httt = ModHeThongThongTinService.Instance.CreateQuery().Where(o => o.DauMoiUCSCID == query.ID).ToList(); if (httt != null) { ModHeThongThongTinService.Instance.Delete(httt); } ModDauMoiUCSCService.Instance.Delete(query); } //thong bao CPViewPage.SetMessage("Đã xóa thành công."); CPViewPage.RefreshPage(); }
public void ActionActivity1(int id) { var item = ModNewsService.Instance.GetByID(id); if (item != null) { if (item.Activity == true) { CPViewPage.Message.ListMessage.Add("Bài viết đã được Duyệt"); CPViewPage.Message.MessageType = Message.MessageTypeEnum.Error; CPViewPage.RefreshPage(); return; } } //update for id ModNewsService.Instance.Update(o => o.ID == id, "@Activity1", 1); //update for != id //ModNewsService.Instance.Update(o => o.ID != id, // "@Activity1", 0); //thong bao CPViewPage.SetMessage("Đã thực hiện thành công."); CPViewPage.RefreshPage(); }
public override void ActionDelete(int[] arrID) { if (CheckPermissions && !CPViewPage.UserPermissions.Delete) { //thong bao CPViewPage.Message.MessageType = Message.MessageTypeEnum.Error; CPViewPage.Message.ListMessage.Add("Bạn không có quyền xóa."); return; } string mess = ""; foreach (var id in arrID) { var item = CPRoleService.Instance.GetByID(id); if (item.Lock) { mess = "Nhóm Quyền " + item.Name + " là nhóm quyền mặc định, không thể xóa."; continue; } //thuc thi var roleID = id; CPUserRoleService.Instance.Delete(o => o.RoleID == roleID); var id1 = id; CPAccessService.Instance.Delete(o => o.RoleID == id1); CPRoleService.Instance.Delete(id); } //thong bao CPViewPage.SetMessage(!string.IsNullOrEmpty(mess) ? mess : "Đã xóa thành công."); CPViewPage.RefreshPage(); }
public override void ActionDelete(int[] arrID) { if (CheckPermissions && !CPViewPage.UserPermissions.Delete) { //thong bao CPViewPage.Message.MessageType = Message.MessageTypeEnum.Error; CPViewPage.Message.ListMessage.Add("Quyền hạn chế."); return; } DataService.Delete("[ID] IN (" + HL.Core.Global.Array.ToString(arrID) + ")"); var query = ModHeThongThongTinService.Instance.CreateQuery().WhereIn(o => o.DonDangKyUCSCID, HL.Core.Global.Array.ToString(arrID)).ToSingle(); if (query != null) { ModHeThongThongTinService.Instance.Delete(query); } // Xoa tong hop nhan luc for (int i = 0; i < arrID.Length; i++) { List <ModTongHopNhanLucUCSCEntity> lstTongHopNhanLuc = ModTongHopNhanLucUCSCService.Instance.GetByDonDangKyUCSCID(arrID[i]); if (lstTongHopNhanLuc != null && lstTongHopNhanLuc.Count > 0) { ModTongHopNhanLucUCSCService.Instance.Delete(lstTongHopNhanLuc); } } //thong bao CPViewPage.SetMessage("Đã xóa thành công."); CPViewPage.RefreshPage(); }
public void ActionImportData(ModCVEModel model) { CPViewPage.Message.MessageType = Message.MessageTypeEnum.Error; string filePath = CPViewPage.Server.MapPath(model.File); if (!filePath.EndsWith(".xls") && !filePath.EndsWith(".xlsx")) { CPViewPage.Message.ListMessage.Add("File không đúng định dạng (yêu cầu: .xls, .xlsx)."); } else if (!System.IO.File.Exists(filePath)) { CPViewPage.Message.ListMessage.Add("File không tồn tại."); } if (CPViewPage.Message.ListMessage.Count == 0) { model.FilePath = filePath; string msg = "", success = ""; int count = Excel.ImportExcel_CVE(model, ref msg, ref success); if (!string.IsNullOrEmpty(msg)) { CPViewPage.Message.ListMessage.Add(msg); } else { CPViewPage.SetMessage("Đã import được " + count + " sự cố." + success); } //CPViewPage.CPRedirect("ModCVE/Index.aspx"); //CPViewPage.Request.RawUrl.Replace("Import.aspx", "Index.aspx"); } }
/* public void ActionAdd(ModProduct_Info_DetailsModel model) { if (model.RecordID > 0) { // khoi tao gia tri mac dinh khi update item = ModProduct_Info_DetailsService.Instance.GetByID(model.RecordID); // Lấy danh sách SP - nhóm thuộc tính List<ModProduct_Groups_PropertiesGroupsEntity> lstInfo_PropertiesGroups = ModProduct_Groups_PropertiesGroupsService.Instance.CreateQuery() //.Where(o => o.ProductInfoId == item.ID) .ToList(); if (lstInfo_PropertiesGroups == null || lstInfo_PropertiesGroups.Count <= 0) { CPViewPage.Message.ListMessage.Add("Sản phẩm chưa có nhóm thuộc tính nào. Yêu cầu chọn các nhóm cho Sản phẩm để có thể nhập thông tin"); ViewBag.Data = item; ViewBag.Model = model; return; } // Lấy chuỗi Id string sPropertiesGroupsId = string.Empty; foreach (ModProduct_Groups_PropertiesGroupsEntity itemEntity in lstInfo_PropertiesGroups) { if (!string.IsNullOrEmpty(sPropertiesGroupsId)) sPropertiesGroupsId += ","; sPropertiesGroupsId += itemEntity.PropertiesGroupsId; } // Where In Lấy danh sách nhóm thuộc tính chứa thuộc tính SP model.GetGroupList = ModProduct_PropertiesGroupsService.Instance.CreateQuery() .WhereIn(o => o.ID, sPropertiesGroupsId) .Where(o => o.Activity == true) .OrderByAsc(o => o.Order).ToList(); // Lấy danh sách thuộc tính thuộc nhóm bên trên model.GetPropertiesList = ModProduct_PropertiesListService.Instance.CreateQuery() .WhereIn(o => o.PropertiesGroupsId, sPropertiesGroupsId) .Where(o => o.Activity == true) //.OrderByAsc(o => o.Order) .ToList(); } else { item = new ModProduct_Info_DetailsEntity(); // khoi tao gia tri mac dinh khi insert } ViewBag.Data = item; ViewBag.Model = model; } */ public void ActionSave(ModProduct_Info_DetailsModel model) { if (ValidSave(model)) { CPViewPage.SetMessage("Thông tin thuộc tính sản phẩm đã được cập nhật."); CPViewPage.Response.Redirect(CPViewPage.Request.RawUrl); } }
public void ActionSave() { if (ValidSave()) { CPViewPage.SetMessage("Thay đổi thông tin thành công."); CPViewPage.CPRedirectHome(); } }
public void ActionSave(UserChangePassModel model) { if (ValidSave(model)) { CPViewPage.SetMessage("Mật khẩu đã thay đổi thành công."); CPViewPage.CPRedirectHome(); } }
public void ActionSave(WebSettingModel model) { if (ValidSave(model)) { CPViewPage.SetMessage("Thông tin đã cập nhật."); CPViewPage.Response.Redirect(CPViewPage.Request.RawUrl.Replace("Add.aspx", "Index.aspx")); } }
public void ActionExport(ModDonDangKyUCSCModel model) { //lấy danh sách // sap xep tu dong string orderBy = AutoSort(model.Sort); // tao danh sach var dbQuery = ModDonDangKyUCSCService.Instance.CreateQuery() .Where(!string.IsNullOrEmpty(model.SearchText), o => o.Name.Contains(model.SearchText)) .Where(model.State > 0, o => (o.State & model.State) == model.State) .WhereIn(o => o.MenuID, WebMenuService.Instance.GetChildIDForCP("DonDangKyUCSC", model.MenuID, model.LangID)) .OrderBy(orderBy); var listEntity = dbQuery.ToList(); if (listEntity == null) { CPViewPage.SetMessage("Không có dữ liệu."); return; } //khai báo tập hợp bản ghi excel List <List <object> > list = new List <List <object> >(); //khai báo 1 dòng excel List <object> _list = null; for (int i = 0; listEntity != null && listEntity.Count > 0 && i < listEntity.Count; i++) { var user = CPUserService.Instance.GetByID(listEntity[i].UserID); _list = new List <object>(); _list.Add(user?.LoginName); _list.Add(listEntity[i].ToChuc_DiaChi); _list.Add(listEntity[i].ToChuc_Email); _list.Add(listEntity[i].ToChuc_DienThoai); _list.Add(listEntity[i].DauMoiLanhDao_DienThoaiDD); _list.Add(listEntity[i].DauMoiLanhDao_Ten); list.Add(_list); } //ghi exel string temp_file = CPViewPage.Server.MapPath("~/Data/upload/files/Excel/ThanhVien_" + string.Format("{0:yyyy_MM_dd}", DateTime.Now) + ".xlsx"); string filePath = CPViewPage.Server.MapPath("~/TTPortal/Templates/Export_ThanhVien.xlsx"); Excel.Export(list, 1, filePath, temp_file); //CPViewPage.Response.Write("Here!6"); CPViewPage.Response.Clear(); CPViewPage.Response.ContentType = "application/excel"; CPViewPage.Response.AppendHeader("Content-Disposition", "attachment; filename=" + System.IO.Path.GetFileName(temp_file)); CPViewPage.Response.WriteFile(temp_file); CPViewPage.Response.End(); //CPViewPage.Response.Write("Here!"); }
public void ActionExport(ModHeThongThongTinModel model) { //lấy danh sách // sap xep tu dong string orderBy = AutoSort(model.Sort); // tao danh sach var dbQuery = ModHeThongThongTinService.Instance.CreateQuery() .Where(!string.IsNullOrEmpty(model.SearchText), o => o.Name.Contains(model.SearchText)) .Where(model.State > 0, o => (o.State & model.State) == model.State) .WhereIn(o => o.MenuID, WebMenuService.Instance.GetChildIDForCP("CapDo", model.MenuID, model.LangID)) .OrderBy(orderBy); var listEntity = dbQuery.ToList(); if (listEntity == null) { CPViewPage.SetMessage("Không có dữ liệu."); return; } //khai báo tập hợp bản ghi excel List <List <object> > list = new List <List <object> >(); //khai báo 1 dòng excel List <object> _list = null; WebMenuEntity menu = null; for (int i = 0; listEntity != null && listEntity.Count > 0 && i < listEntity.Count; i++) { _list = new List <object>(); menu = WebMenuService.Instance.CreateQuery() .Where(o => o.Activity == true && o.ID == listEntity[i].MenuID) .ToSingle(); _list.Add(menu?.Name); _list.Add(listEntity[i].Name); list.Add(_list); } //ghi exel string temp_file = CPViewPage.Server.MapPath("~/Data/upload/files/Excel/HTTT_" + string.Format("{0:yyyy_MM_dd}", DateTime.Now) + ".xlsx"); string filePath = CPViewPage.Server.MapPath("~/TTPortal/Templates/Export_HTTT.xlsx"); Excel.Export(list, 1, filePath, temp_file); //CPViewPage.Response.Write("Here!6"); CPViewPage.Response.Clear(); CPViewPage.Response.ContentType = "application/excel"; CPViewPage.Response.AppendHeader("Content-Disposition", "attachment; filename=" + System.IO.Path.GetFileName(temp_file)); CPViewPage.Response.WriteFile(temp_file); CPViewPage.Response.End(); //CPViewPage.Response.Write("Here!"); }
public void ActionDefaultGX(int id) { //update for id SysSiteService.Instance.Update(o => o.ID == id, "@Default", 1); //update for != id SysSiteService.Instance.Update(o => o.ID != id, "@Default", 0); //thong bao CPViewPage.SetMessage("Đã thực hiện thành công."); CPViewPage.RefreshPage(); }
protected void SaveNewRedirect_Next(int RecordID, int EntityID) { CPViewPage.SetMessage("Thông tin đã cập nhật."); if (RecordID > 0) { CPViewPage.Response.Redirect(CPViewPage.Request.RawUrl.Replace("/" + RecordID, "/" + EntityID)); } else { CPViewPage.Response.Redirect(CPViewPage.Request.RawUrl); } }
public void ActionResolveGX(int id) { //update for id ModIncidentService.Instance.Update(o => o.ID == id, "@Resolve", 1); //update for != id //ModIncidentService.Instance.Update(o => o.ID != id, // "@Resolve", 0); //thong bao CPViewPage.SetMessage("Đã thực hiện thành công."); CPViewPage.RefreshPage(); }
public override void ActionDelete(int[] arrID) { if (CheckPermissions && !CPViewPage.UserPermissions.Delete) { //thong bao CPViewPage.Message.MessageType = Message.MessageTypeEnum.Error; CPViewPage.Message.ListMessage.Add("Quyền hạn chế."); return; } DataService.Delete("[ID] IN (" + HL.Core.Global.Array.ToString(arrID) + ")"); //thong bao CPViewPage.SetMessage("Đã xóa thành công."); CPViewPage.RefreshPage(); }
public void ActionApply(WebSettingModel model) { if (ValidSave(model)) { CPViewPage.SetMessage("Thông tin đã cập nhật."); if (model.RecordID > 0) { CPViewPage.RefreshPage(); } else { CPViewPage.Response.Redirect(CPViewPage.Request.RawUrl + "/RecordID/" + entity.ID); } } }
public override void ActionDelete(int[] arrID) { if (CheckPermissions && !CPViewPage.UserPermissions.Delete) { //thong bao CPViewPage.Message.MessageType = Message.MessageTypeEnum.Error; CPViewPage.Message.ListMessage.Add("Bạn không có quyền xóa."); return; } for (int i = 0; arrID.Length > 0 && i < arrID.Length; i++) { if (arrID[i] == CPLogin.CurrentUser.ID) { CPViewPage.Message.MessageType = Message.MessageTypeEnum.Error; CPViewPage.SetMessage("Bạn không thể xóa tài khoản của mình."); } else { var _id = arrID[i]; var _checkIsRoleAdmin = CPRoleService.Instance.CreateQuery() .SelectJoin(false, o => new { o.ID, o.Lock }) .Join.LeftJoin(true, CPUserRoleService.Instance.CreateQuery().Where(x => x.UserID == _id), o => o.ID, x => x.RoleID) .WhereJoin(o => o.Lock == true || o.Name == "Administrator") .ToSingle_Cache(); if (_checkIsRoleAdmin != null && !_checkIsRoleAdmin.Lock) { DataService.Delete("[ID]=" + arrID[i] + ""); } } } CPUserLogService.Instance.Save(new CPUserLogEntity { Module = "User", Note = "Đã xóa", UserID = CPLogin.UserID, Created = DateTime.Now, IP = Core.Web.HttpRequest.IP, TypeAction = "Đã xóa" }); //thong bao // CPViewPage.SetMessage("Đã xóa thành công."); CPViewPage.RefreshPage(); }
public override void ActionDelete(int[] arrID) { if (CheckPermissions && !CPViewPage.UserPermissions.Delete) { //thong bao CPViewPage.Message.MessageType = Message.MessageTypeEnum.Error; CPViewPage.Message.ListMessage.Add("Bạn không có quyền xóa."); return; } var list = new List <int>(); GetPageIDChildForDelete(ref list, arrID); if (list.Count > 1) { CPViewPage.Alert("Menu bạn xóa còn chứa Dữ liệu. Hãy kiểm tra kĩ trước khi xóa."); return; } foreach (var pageId in list) { //xoa cleanurl var id = pageId; var _page = SysPageService.Instance.CreateQuery().Select(o => o.MenuID).Where(o => o.ID == id).ToSingle(); var sWhere = "[MenuID]=" + (_page != null ? _page.MenuID : 0) + ""; var _Site = SysSiteService.Instance.CreateQuery().Select(o => o.ID).Where(o => o.PageID == id).Count().ToValue().ToBool(); if (_Site) { CPViewPage.Alert("Đây là trang mặc định của website, không thể xóa. Xóa sẽ gây lỗi website"); return; } if (!string.IsNullOrEmpty(_page.Content)) { CPViewPage.Alert("Danh mục bạn xóa còn chứa Bài viết. Hãy xóa hết Bài viết trong chuyên mục muốn xóa trước."); return; } ModCleanURLService.Instance.Delete(o => o.Type == "Page" && o.Value == id); //xoa Page SysPageService.Instance.Delete(pageId); } //thong bao CPViewPage.SetMessage("Đã xóa thành công."); CPViewPage.RefreshPage(); }
public void ActionStateSendGX(int[] arrID) { if (CheckPermissions && !CPViewPage.UserPermissions.Approve) { //thong bao CPViewPage.Message.MessageType = Message.MessageTypeEnum.Error; CPViewPage.Message.ListMessage.Add("Quyền hạn chế."); return; } DataService.Update("[ID]=" + arrID[0], "@StateSend", arrID[1]); //thong bao CPViewPage.SetMessage("Đã thực hiện thành công."); CPViewPage.RefreshPage(); }
/// <summary> /// Delete - Modified by CanTV /// </summary> /// <param name="arrID"></param> public override void ActionDelete(int[] arrID) { string sMess = string.Empty; try { if (CheckPermissions && !CPViewPage.UserPermissions.Delete) { //thong bao CPViewPage.Message.MessageType = Message.MessageTypeEnum.Error; CPViewPage.Message.ListMessage.Add("Quyền hạn chế."); return; } int iXoaKy_DaiLy_DonHang_SanPham = ModDT_Ky_DaiLy_DonHang_SanPhamService.Instance.Delete(@"ModDTKyDaiLyDonHangId IN (SELECT ID FROM Mod_DT_Ky_DaiLy_DonHang WHERE ModDTKyDaiLyId IN (SELECT ID FROM Mod_DT_Ky_DaiLy WHERE ModDtKyId IN (SELECT ID FROM Mod_DT_Ky WHERE ID IN (" + VSW.Core.Global.Array.ToString(arrID) + "))))"); int iXoaKy_DaiLy_DonHang = ModDT_Ky_DaiLy_DonHangService.Instance.Delete(@"ModDTKyDaiLyId IN (SELECT ID FROM Mod_DT_Ky_DaiLy WHERE ModDtKyId IN (SELECT ID FROM Mod_DT_Ky WHERE ID IN (" + VSW.Core.Global.Array.ToString(arrID) + ")))"); int iXoaKy_DaiLy = ModDT_Ky_DaiLyService.Instance.Delete(@"ModDtKyId IN (SELECT ID FROM Mod_DT_Ky WHERE ID IN (" + VSW.Core.Global.Array.ToString(arrID) + "))"); int iXoaKy = ModDT_KyService.Instance.Delete("[ID] IN (" + VSW.Core.Global.Array.ToString(arrID) + ")"); // thành công sMess = "Đã xóa thành công."; } catch (Exception ex) { // Lỗi phát sinh sMess = "Xóa thất bại. Lỗi phát sinh trong quá trình xóa hoặc tồn tại ràng buộc dữ liệu:" + ex.Message; } //thong bao CPViewPage.SetMessage(sMess); CPViewPage.RefreshPage(); }
public override void ActionDelete(int[] arrID) { if (CheckPermissions && !CPViewPage.UserPermissions.Delete) { //thong bao CPViewPage.Message.MessageType = Message.MessageTypeEnum.Error; CPViewPage.Message.ListMessage.Add("Quyền hạn chế."); return; } DataService.Delete("[ID] IN (" + HL.Core.Global.Array.ToString(arrID) + ")"); var query = ModInfoMagicService.Instance.CreateQuery().WhereIn(o => o.BaoCaoBanDauSuCoID, HL.Core.Global.Array.ToString(arrID)).ToList(); ModInfoMagicService.Instance.Delete(query); //thong bao CPViewPage.SetMessage("Đã xóa thành công."); CPViewPage.RefreshPage(); }
public void ActionAdd(ModBaoCaoSuCoModel model) { // Lay user chiu trach nhiem xu ly su co int userTrachNhiem = 0; if (CPLogin.CurrentUser.IsAdministrator == false) { userTrachNhiem = CPLogin.CurrentUser.ID; } if (model.RecordID > 0) { entity = ModBaoCaoSuCoService.Instance.GetByID(model.RecordID); if (userTrachNhiem > 0) { if (entity.UserID2 != userTrachNhiem) { CPViewPage.Message.MessageType = Message.MessageTypeEnum.Notice; CPViewPage.SetMessage("Bản ghi không tồn tại."); CPViewPage.Response.Redirect(CPViewPage.Request.RawUrl.Replace("Add.aspx", "Index.aspx")); } } // khoi tao gia tri mac dinh khi update entity.UserID1 = CPLogin.CurrentUser.ID; entity.Published1 = DateTime.Now; } else { entity = new ModBaoCaoSuCoEntity(); // khoi tao gia tri mac dinh khi insert entity.MenuID = model.MenuID; entity.Published = DateTime.Now; entity.Activity = CPViewPage.UserPermissions.Approve; entity.Order = GetMaxOrder(model); } ViewBag.Data = entity; ViewBag.Model = model; }
public override void ActionDelete(int[] arrID) { string sMess = string.Empty; try { ModProduct_Order_DetailsService.Instance.Delete("[OrderId] IN (" + VSW.Core.Global.Array.ToString(arrID) + ")"); DataService.Delete("[ID] IN (" + VSW.Core.Global.Array.ToString(arrID) + ")"); // thành công sMess = "Đã xóa thành công."; } catch (Exception ex) { // Lỗi phát sinh sMess = "Xóa thất bại. Lỗi phát sinh trong quá trình xóa hoặc tồn tại ràng buộc dữ liệu:" + ex.Message; } //thong bao CPViewPage.SetMessage(sMess); CPViewPage.RefreshPage(); }
public override void ActionDelete(int[] arrID) { List <int> list = new List <int>(); GetMenuIDChildForDelete(ref list, arrID); if (list != null && list.Count > 0) { string sWhere = "[ID] IN (" + HL.Core.Global.Array.ToString(list.ToArray()) + ")"; var news = ModNewsService.Instance.CreateQuery() .WhereIn(o => o.MenuID, HL.Core.Global.Array.ToString(list.ToArray())) .ToList(); var advs = ModAdvService.Instance.CreateQuery() .WhereIn(o => o.MenuID, HL.Core.Global.Array.ToString(list.ToArray())) .ToList(); if (news != null && news.Count > 0 || advs != null && advs.Count > 0) { CPViewPage.Message.ListMessage.Add("Chuyên mục đang được sử dụng."); CPViewPage.Message.MessageType = Message.MessageTypeEnum.Error; return; } //xoa menu WebMenuService.Instance.Delete(sWhere); sWhere = "[MenuID] IN (" + HL.Core.Global.Array.ToString(list.ToArray()) + ")"; //xoa news ModNewsService.Instance.Delete(sWhere); //xoa adv ModAdvService.Instance.Delete(sWhere); } //thong bao CPViewPage.SetMessage("Đã xóa thành công."); CPViewPage.RefreshPage(); }
public override void ActionDelete(int[] arrID) { for (int i = 0; i < arrID.Length; i++) { int id = arrID[i]; CPRoleEntity _Item = CPRoleService.Instance.GetByID(id); if (_Item.Lock) { continue; } //thuc thi CPUserRoleService.Instance.Delete(o => o.RoleID == id); CPAccessService.Instance.Delete(o => o.RoleID == id); CPRoleService.Instance.Delete(id); } //thong bao CPViewPage.SetMessage("Đã xóa thành công."); CPViewPage.RefreshPage(); }
public void ActionShowMenuTop(int[] arrID) { if (CheckPermissions && !CPViewPage.UserPermissions.Approve) { //thong bao CPViewPage.Message.MessageType = Message.MessageTypeEnum.Error; CPViewPage.Message.ListMessage.Add("Quyền hạn chế."); return; } var product = SysPageService.Instance.GetByID(arrID[0]); if (product == null) { return; } product.ShowMenuTop = Core.Global.Convert.ToBool(arrID[1]); SysPageService.Instance.Save(product, o => o.ShowMenuTop); //thong bao CPViewPage.SetMessage(arrID[1] == 0 ? "Đã bỏ hiển thị MenuTop." : "Đã hiển thị Menu Top"); CPViewPage.RefreshPage(); }
public void ActionApply(SysResourceModel model) { if (model.Type > 0) { if (model.Type == 1 && !string.IsNullOrEmpty(model.Value1)) { string[] Arr = model.Value1.Split('\n'); for (int i = 0; i < Arr.Length; i++) { string s = Arr[i].Trim(); if (string.IsNullOrEmpty(s)) { continue; } if (s.StartsWith("//")) { continue; } int index = s.IndexOf('='); if (index == -1) { continue; } string key = s.Substring(0, index).Trim(); string value = s.Substring(index + 1).Trim(); if (WebResourceService.Instance.CP_HasExists(key, model.LangID1)) { if (model.Overwrite1) { var rs = WebResourceService.Instance.CreateQuery() .Where(o => o.LangID == model.LangID1 && o.Code == key) .ToSingle(); rs.Value = value; WebResourceService.Instance.Save(rs, o => o.Value); } } else { WebResourceService.Instance.Save(new WebResourceEntity { LangID = model.LangID1, Code = key, Value = value }); } } } else if (model.Type == 2) { if (model.FLangID2 != model.TLangID2) { var listRS = WebResourceService.Instance.CreateQuery() .Where(o => o.LangID == model.FLangID2) .ToList(); for (int i = 0; listRS != null && i < listRS.Count; i++) { string key = listRS[i].Code; string value = listRS[i].Value; if (WebResourceService.Instance.CP_HasExists(key, model.TLangID2)) { if (model.Overwrite2) { var rs = WebResourceService.Instance.CreateQuery() .Where(o => o.LangID == model.TLangID2 && o.Code == key) .ToSingle(); rs.Value = value; WebResourceService.Instance.Save(rs, o => o.Value); } } else { WebResourceService.Instance.Save(new WebResourceEntity { LangID = model.TLangID2, Code = key, Value = value }); } } } } else if (model.Type == 3) { var listRS = WebResourceService.Instance.CreateQuery() .Where(o => o.LangID == model.LangID3) .ToList(); for (int i = 0; listRS != null && i < listRS.Count; i++) { string key = listRS[i].Code; string value = GetTranslate(listRS[i].Value, model.FLangID3, model.TLangID3); if (value != string.Empty) { listRS[i].Value = value; WebResourceService.Instance.Save(listRS[i], o => o.Value); } } } if ((model.Type == 1 && !string.IsNullOrEmpty(model.Value1)) || model.Type == 2 || model.Type == 3) { CPViewPage.SetMessage("Thông tin đã cập nhật."); return; } } if (ValidSave(model)) { ApplyRedirect(model.RecordID, entity.ID); } }