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();
        }
Beispiel #3
0
        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();
        }
Beispiel #4
0
        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();
        }
Beispiel #5
0
        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();
        }
Beispiel #6
0
        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();
        }
Beispiel #7
0
        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();
        }
Beispiel #8
0
        public void ActionAdd(ModBaoCaoDienBienSuCoEntity entity, MAppend append, string endCode)
        {
            if (entity.ID == 0)
            {
                entity = new ModBaoCaoDienBienSuCoEntity();

                // khoi tao gia tri mac dinh khi insert
                entity.MenuID = 0;
                entity.UserID = Lib.Global.CPLogin.UserID;
                DateTime d = DateTime.Now;
                entity.ChiTiet_NgayTao = d;
                entity.Activity        = CPViewPage.UserPermissions.Approve;
            }
            else
            {
                bool isValid = ValidBCDienBien(ref entity, append, endCode);
                ViewBag.BaoCao = entity;

                if (isValid == true)
                {
                    int                 userId = HL.Lib.Global.CPLogin.UserIDOnWeb;
                    string              ec     = endCode.ToLower();
                    string[]            ecArr  = ec.Split('-');
                    string              codes  = ecArr[0].ToString();
                    ModBaoCaoSuCoEntity sc     = ModBaoCaoSuCoService.Instance.CreateQuery()
                                                 .Where(userId > 0, o => o.UserID == userId)
                                                 .Where(o => o.Code == codes)
                                                 .ToSingle();
                    if (sc != null)
                    {
                        string code = "BCDBSC" + ModBaoCaoDienBienSuCoService.Instance.GetMaxID();
                        entity.Name             = code;
                        entity.Code             = Data.GetCode(code);
                        entity.UserID           = Lib.Global.CPLogin.UserIDOnWeb;
                        entity.Activity         = true;
                        entity.BaoCaoSuCoID     = sc.ID;
                        entity.ToChuc_Ten       = sc.Name;
                        entity.ToChuc_DiaChi    = sc.Address;
                        entity.ToChuc_DienThoai = sc.Phone;
                        entity.ToChuc_Email     = sc.Email;
                        int id = ModBaoCaoDienBienSuCoService.Instance.Save(entity);

                        CPViewPage.Alert("Thêm báo cáo diễn biến thành công.");
                        CPViewPage.RefreshPage();
                        //ViewPage.Navigate("/vn/Bao-cao-su-co/" + sc.Code + "-bc-dien-bien-su-co.aspx");
                    }
                }
            }

            ViewBag.Data = entity;
        }
Beispiel #9
0
        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();
        }
Beispiel #10
0
        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();
        }
Beispiel #11
0
        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();
        }
Beispiel #13
0
        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();
        }
Beispiel #14
0
        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();
        }
Beispiel #15
0
        /// <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();
        }
Beispiel #16
0
        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 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();
        }
Beispiel #18
0
        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();
        }
Beispiel #20
0
        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();
        }
Beispiel #21
0
        public void ActionActivateStyle(ModParameterModel model)
        {
            if (model == null)
            {
                return;
            }

            string NameStyle = model.NameStyle;

            // Cập nhật
            var objStyleActivate = ModParametersService.Instance.GetByID((int)EnumValue.Parameter.TEMPLATE_ACTIVATE);

            if (objStyleActivate == null)
            {
                return;
            }

            objStyleActivate.Value = NameStyle;

            // Lưu lại
            ModParametersService.Instance.Save(objStyleActivate);

            CPViewPage.RefreshPage();
        }
        public void ActionChangeLang(string langCode)
        {
            Cookies.SetValue("CP.Lang", langCode, true);

            CPViewPage.RefreshPage();
        }
        public void ActionDeleteproductincart(int[] arrID)
        {
            int ProductDetailId = arrID[0]; int iOrderId = arrID[1];

            if (ProductDetailId <= 0 || iOrderId <= 0)
            {
                CPViewPage.SetMessage("Không tìm thấy thông tin đơn hàng. Hãy thử lại");
                CPViewPage.RefreshPage();
                return;
            }

            ModProduct_Order_DetailsService.Instance.Delete(ProductDetailId);

            // Cập nhật lại thông tin đơn hàng
            var Order = ModProduct_OrderService.Instance.GetByID(iOrderId);

            if (Order == null)
            {
                CPViewPage.SetMessage("Xóa sản phẩm khỏi đơn hàng thất bại. Hãy thử lại");
                CPViewPage.RefreshPage();
                return;
            }

            var lstOrderDetail = ModProduct_Order_DetailsService.Instance.CreateQuery().Where(o => o.OrderId == Order.ID).ToList();

            if (lstOrderDetail == null || lstOrderDetail.Count <= 0)
            {
                Order.QuantityProduct = 0;
                Order.QuantityTotal   = 0;
                Order.TotalFrice      = 0;
                Order.TotalFriceFirst = 0;
            }
            // Nếu còn sản phẩm --> Cập nhật thông tin
            else
            {
                int    iQuantityTotal   = 0;
                int    iQuantityProduct = 0;
                double dTotalFriceFirst = 0;

                foreach (var itemCart in lstOrderDetail)
                {
                    // Số lượng tất cả
                    iQuantityTotal += itemCart.Quantity;

                    // số lượng từng loại
                    iQuantityProduct++;

                    dTotalFriceFirst += itemCart.TotalFrice;
                }

                // Cập nhật lại thông tin đơn hàng
                Order.QuantityProduct = iQuantityProduct;
                Order.QuantityTotal   = iQuantityTotal;
                Order.Discount        = 0;

                // Số tiền tính được (Bao gồm cả VAT nếu có)
                Order.TotalFriceFirst = dTotalFriceFirst;

                // Sau khi đã giảm trừ (Giả sử từ cho 200 khi đặt hàng online)
                Order.TotalFrice = Order.TotalFriceFirst - Order.Discount;
            }

            // Ngày thay đổi
            Order.ModifiedDate = DateTime.Now;

            // Lưu lại
            ModProduct_OrderService.Instance.Save(Order);

            CPViewPage.SetMessage("Xóa sản phẩm khỏi đơn hàng thành công.");
            CPViewPage.RefreshPage();
        }