Esempio n. 1
0
        public ActionResult AddUser(string key, string code, string json)
        {
            var msg = new JsonMessage(false, "Thêm mới dữ liệu thành công.");

            try
            {
                if (key == Keyapi)
                {
                    var user             = JsonConvert.DeserializeObject <DNUserAddItem>(json);
                    var saltKey          = FDIUtils.CreateSaltKey(5);
                    var sha1PasswordHash = FDIUtils.CreatePasswordHash(user.PasswordSalt, saltKey);
                    var obj = new DN_Users {
                        UserId = Guid.NewGuid(), PasswordSalt = saltKey, Password = sha1PasswordHash, AgencyID = Agencyid(), CreateDate = ConvertDate.TotalSeconds(DateTime.Now), IsDeleted = false
                    };
                    UpdateBase(obj, user);
                    _da.Add(obj);
                    _da.Save();
                }
            }
            catch (Exception ex)
            {
                msg.Erros   = true;
                msg.Message = "Dữ liệu chưa được thêm mới.";
                Log2File.LogExceptionToFile(ex);
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public ActionResult Add(string key, string json)
        {
            var model = new Base.Customer();
            var msg   = new JsonMessage(false, "Thêm mới dữ liệu thành công.");

            try
            {
                UpdateModel(model);
                var birth    = Request["Birthday_"];
                var parent   = Request["Parent"];
                var serial   = Request["CardSerial"];
                var pin      = Request["PinCard"];
                var NoteCate = Request["NoteCate"];
                if (!string.IsNullOrEmpty(serial))
                {
                    var carditem = _da.GetCardItem(serial, pin);
                    model.CardID = carditem.ID;
                }
                model.FullName     = HttpUtility.UrlDecode(model.FullName);
                model.Address      = HttpUtility.UrlDecode(model.Address);
                model.Birthday     = birth.StringToDecimal();
                model.DateCreated  = ConvertDate.TotalSeconds(DateTime.Now);
                model.IsDelete     = false;
                model.IsActive     = true;
                model.PasswordSalt = FDIUtils.CreateSaltKey(5);
                model.PassWord     = FDIUtils.CreatePasswordHash(model.PassWord ?? "fdi123456", model.PasswordSalt);
                if (!string.IsNullOrEmpty(NoteCate))
                {
                    var customerCare = new Customer_Care
                    {
                        Note     = HttpUtility.UrlDecode(NoteCate),
                        AgencyId = Agencyid()
                    };
                    model.Customer_Care.Add(customerCare);
                }
                _da.Add(model);
                _da.Save();
            }
            catch (Exception ex)
            {
                msg.Erros   = true;
                msg.Message = "Dữ liệu chưa được thêm mới";
                Log2File.LogExceptionToFile(ex);
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
Esempio n. 3
0
        public ActionResult ChangePass(string oldPass, string newPass)
        {
            var customer = _dl.GetByUserID(CustomerId);
            var pas      = FDIUtils.CreatePasswordHash(oldPass, customer.PasswordSalt);

            if (customer.PassWord != pas)
            {
                return(Json(new JsonMessage(true, "Mật khẩu cũ không đúng")));
            }

            var saltKey          = FDIUtils.CreateSaltKey(5);
            var sha1PasswordHash = FDIUtils.CreatePasswordHash(newPass, saltKey);

            customer.PasswordSalt = saltKey;
            customer.PassWord     = sha1PasswordHash;
            _dl.Save();

            return(Json(new JsonMessage(false, "Đổi mật khẩu thành công")));
        }
Esempio n. 4
0
 public ActionResult UpdateUser(string key, string username, int gender, string address, string birthday,
                                string fullname, string pass, string company, string depart, string mst, string stk, string bankname, string latitute, string longitude)
 {
     if (key != Keyapi)
     {
         return(Json(0, JsonRequestBehavior.AllowGet));
     }
     try
     {
         var model = _da.GetByUsername(username);
         if (model != null)
         {
             model.Address         = address;
             model.Gender          = gender == 1;
             model.BirthDay        = ConvertUtil.ToDateTime(birthday).TotalSeconds();
             model.LoweredUserName = fullname;
             if (!string.IsNullOrEmpty(pass))
             {
                 var saltKey          = FDIUtils.CreateSaltKey(5);
                 var sha1PasswordHash = FDIUtils.CreatePasswordHash(pass, saltKey);
                 model.Password = sha1PasswordHash;
             }
             var agency = _agencyDa.GetById(model.AgencyID ?? 0);
             agency.Company    = company;
             agency.MST        = mst;
             agency.Department = depart;
             agency.STK        = stk;
             agency.BankName   = bankname;
             agency.Latitute   = latitute;
             agency.Longitude  = longitude;
             _agencyDa.Save();
             _da.Save();
             return(Json(1, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception e)
     {
         return(Json(e.Message, JsonRequestBehavior.AllowGet));
     }
     return(Json(3, JsonRequestBehavior.AllowGet));
 }
Esempio n. 5
0
        public ActionResult Register(CustomerItem customer)
        {
            var objr = new CustomerAppItem
            {
                Status = 0
            };

            try
            {
                if (!string.IsNullOrEmpty(customer.Phone) && !string.IsNullOrEmpty(customer.Password))
                {
                    if (_da.CheckUserName(customer.Phone))
                    {
                        return(Json(new BaseResponse <CustomerItem>()
                        {
                            Erros = true,
                            Message = "Số điện thoại đã tồn tại",
                        }, JsonRequestBehavior.AllowGet));
                    }
                    var daten            = DateTime.Now;
                    var date             = daten.TotalSeconds();
                    var saltKey          = FDIUtils.CreateSaltKey(5);
                    var sha1PasswordHash = FDIUtils.CreatePasswordHash(customer.Password, saltKey);

                    //get agencyinfo
                    var agencyDA = new AgencyDA();
                    var agency   = agencyDA.GetItem(customer.PhoneAgency);
                    var obj      = new Base.Customer
                    {
                        FullName     = customer.FullName,
                        Phone        = customer.Phone,
                        PasswordSalt = saltKey,
                        PassWord     = sha1PasswordHash,
                        UserName     = customer.UserName,
                        DateCreated  = date,
                        IsDelete     = false,
                        IsActive     = true,
                        Reward       = 0,
                        AgencyID     = agency?.ID
                    };
                    _da.Add(obj);
                    _da.Save();

                    IAuthContainerModel model = new JWTContainerModel()
                    {
                        Claims = new Claim[]
                        {
                            new Claim(ClaimTypes.Name, obj.UserName),
                            new Claim("ID", obj.ID.ToString()),
                        }
                    };

                    IAuthService authService = new JWTService();
                    var          token       = authService.GenerateToken(model);
                    var          result      = new BaseResponse <CustomerItem>()
                    {
                        Erros = false,
                        Data  = new CustomerItem()
                        {
                            FullName = obj.FullName,
                            Phone    = obj.Phone,
                            Token    = token
                        }
                    };

                    return(Json(result, JsonRequestBehavior.AllowGet));

                    var datee = daten.AddDays(5).TotalSeconds();
                    //var lg = new Ultils();
                    var code    = Ultils.CodeLogin(daten);
                    var dNlogin = new DN_Login
                    {
                        CustomerID  = obj.ID,
                        DateCreated = date,
                        DateEnd     = datee,
                        Code        = code,
                        IsOut       = false
                    };
                    _dl.Add(dNlogin);
                    _dl.Save();
                    objr = new CustomerAppItem
                    {
                        ID     = obj.ID,
                        Status = 1,
                    };
                }
            }
            catch (Exception ex)
            {
                Log2File.LogExceptionToFile(ex);
            }
            return(Json(objr, JsonRequestBehavior.AllowGet));
        }
Esempio n. 6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="key"></param>
        /// <param name="phone">UserName</param>
        /// <param name="mobile">SĐT3G</param>
        /// <param name="pass">Mật khẩu</param>
        /// <param name="address">Địa chỉ</param>
        /// <returns></returns>
        public ActionResult Addapp(string key, string phone, string mobile, string pass, string address, string name, int gid)
        {
            var objr = new CustomerAppItem
            {
                UserName = phone,
                Status   = 0
            };

            try
            {
                if (key == Keyapi && !string.IsNullOrEmpty(phone) && !string.IsNullOrEmpty(pass))
                {
                    if (_da.CheckUserName(phone))
                    {
                        return(Json(objr, JsonRequestBehavior.AllowGet));
                    }
                    var daten            = DateTime.Now;
                    var date             = daten.TotalSeconds();
                    var saltKey          = FDIUtils.CreateSaltKey(5);
                    var sha1PasswordHash = FDIUtils.CreatePasswordHash(pass, saltKey);
                    var obj = new Base.Customer
                    {
                        Address      = address,
                        FullName     = name,
                        GroupID      = gid,
                        Phone        = phone,
                        PasswordSalt = saltKey,
                        PassWord     = sha1PasswordHash,
                        UserName     = phone,
                        DateCreated  = date,
                        IsDelete     = false,
                        IsActive     = true,
                        Reward       = 0,
                    };
                    _da.Add(obj);
                    _da.Save();
                    var datee = daten.AddDays(5).TotalSeconds();
                    //var lg = new Ultils();
                    var code    = Ultils.CodeLogin(daten);
                    var dNlogin = new DN_Login
                    {
                        CustomerID  = obj.ID,
                        DateCreated = date,
                        DateEnd     = datee,
                        Code        = code,
                        IsOut       = false
                    };
                    _dl.Add(dNlogin);
                    _dl.Save();
                    objr = new CustomerAppItem
                    {
                        ID       = obj.ID,
                        UserName = phone,
                        Address  = address,
                        FullName = name,
                        Phone    = mobile,
                        Reward   = 0,
                        GroupID  = gid,
                        Status   = 1,
                    };
                }
            }
            catch (Exception ex)
            {
                Log2File.LogExceptionToFile(ex);
            }
            return(Json(objr, JsonRequestBehavior.AllowGet));
        }
Esempio n. 7
0
        public ActionResult Add(string key, string json)
        {
            var msg = new JsonMessage(false, "Thêm mới dữ liệu thành công.");

            try
            {
                if (key == Keyapi)
                {
                    var date    = DateTime.Now.TotalSeconds();
                    var objitem = JsonConvert.DeserializeObject <AgencyItem>(json);
                    var obj     = new DN_Agency
                    {
                        IsDelete    = false,
                        IsLock      = false,
                        IsOut       = false,
                        CreateDate  = date,
                        WalletValue = 10000000,
                        CashOut     = 0,
                    };
                    obj = UpdateBase(obj, objitem);
                    _da.Add(obj);
                    _da.Save();
                    if (objitem.GroupID > 0)
                    {
                        _da.InsertDNModule(objitem.GroupID, obj.ID);
                    }
                    var saltKey          = FDIUtils.CreateSaltKey(5);
                    var sha1PasswordHash = FDIUtils.CreatePasswordHash(objitem.Pass, saltKey);
                    var user             = new DN_Users
                    {
                        UserId          = Guid.NewGuid(),
                        PasswordSalt    = saltKey,
                        Password        = sha1PasswordHash,
                        UserName        = objitem.UserName,
                        LoweredUserName = obj.Name,
                        Email           = obj.Email,
                        Address         = obj.Address,
                        AgencyID        = obj.ID,
                        Mobile          = obj.Phone,
                        IsApproved      = true,
                        IsLockedOut     = false,
                        CreateDate      = date,
                        IsDeleted       = false
                    };
                    _daUserDa.Add(user);
                    _daUserDa.Save();
                    var role = new DN_Roles {
                        RoleId = Guid.NewGuid(), RoleName = "Admin", LoweredRoleName = "admin", AgencyID = obj.ID, Description = "Quản trị"
                    };
                    _darRoleDa.Add(role);
                    var dnUsersInRoles = new DN_UsersInRoles
                    {
                        UserId      = user.UserId,
                        AgencyID    = obj.ID,
                        DateCreated = date,
                        IsDelete    = false
                    };
                    role.DN_UsersInRoles.Add(dnUsersInRoles);
                    _darRoleDa.Save();
                }
            }
            catch (Exception ex)
            {
                msg.Erros   = true;
                msg.Message = "Dữ liệu chưa được thêm mới.";
                Log2File.LogExceptionToFile(ex);
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
Esempio n. 8
0
        public ActionResult Update(string key, string json)
        {
            var msg = new JsonMessage(false, "Cập nhật dữ liệu thành công.");

            try
            {
                if (key == Keyapi)
                {
                    var objitem = JsonConvert.DeserializeObject <AgencyItem>(json);
                    var obj     = _da.GetById(objitem.ID);
                    var check   = obj.GroupID != objitem.GroupID;
                    if (obj.GroupID > 0 && check)
                    {
                        _da.InsertDNModule(objitem.GroupID, obj.ID, true);
                    }

                    obj = UpdateBase(obj, objitem);
                    _da.Save();
                    if (!string.IsNullOrEmpty(objitem.Pass))
                    {
                        var user = _daUserDa.GetUserByUserName(objitem.UserName);
                        if (user != null)
                        {
                            var sha1PasswordHash = FDIUtils.CreatePasswordHash(objitem.Pass, user.PasswordSalt);
                            user.Password = sha1PasswordHash;
                        }
                        else
                        {
                            var date = ConvertDate.TotalSeconds(DateTime.Now);
                            var role = _darRoleDa.GetByName("Admin");
                            if (role == null)
                            {
                                role = new DN_Roles {
                                    RoleId = Guid.NewGuid(), RoleName = "Admin", LoweredRoleName = "admin", AgencyID = obj.ID, Description = "Quản trị"
                                };
                                _darRoleDa.Add(role);
                                _darRoleDa.Save();
                            }
                            var saltKey          = FDIUtils.CreateSaltKey(5);
                            var sha1PasswordHash = FDIUtils.CreatePasswordHash(objitem.Pass, saltKey);
                            user = new DN_Users
                            {
                                UserId          = Guid.NewGuid(),
                                PasswordSalt    = saltKey,
                                Password        = sha1PasswordHash,
                                UserName        = objitem.UserName,
                                LoweredUserName = obj.Name,
                                Email           = obj.Email,
                                Address         = obj.Address,
                                AgencyID        = obj.ID,
                                Mobile          = obj.Phone,
                                IsApproved      = true,
                                IsLockedOut     = false,
                                CreateDate      = date,
                                IsDeleted       = false
                            };
                            _daUserDa.Add(user);
                            var dnUsersInRoles = new DN_UsersInRoles
                            {
                                UserId      = role.RoleId,
                                AgencyID    = obj.ID,
                                DateCreated = date
                            };
                            user.DN_UsersInRoles.Add(dnUsersInRoles);
                        }
                        _daUserDa.Save();
                    }
                }
            }
            catch (Exception ex)
            {
                msg.Erros   = true;
                msg.Message = "Dữ liệu chưa được cập nhật.";
                Log2File.LogExceptionToFile(ex);
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
Esempio n. 9
0
        public ActionResult Actions()
        {
            var model = new Customer();
            var msg   = new JsonMessage(false, "Thêm mới dữ liệu thành công.");

            //List<Customer> ltsCustomerItems;
            //StringBuilder stbMessage;
            switch (DoAction)
            {
            case ActionType.Add:
                try
                {
                    UpdateModel(model);
                    var birth    = Request["Birthday_"];
                    var parent   = Request["Parent"];
                    var serial   = Request["CardSerial"];
                    var pin      = Request["PinCard"];
                    var NoteCate = Request["NoteCate"];

                    if (!string.IsNullOrEmpty(serial))
                    {
                        var carditem = _da.GetCardItem(serial, pin);
                        model.CardID = carditem.ID;
                    }
                    model.Birthday     = ConvertDate.TotalSeconds(ConvertUtil.ToDateTime(birth));
                    model.DateCreated  = ConvertDate.TotalSeconds(DateTime.Now);
                    model.IsDelete     = false;
                    model.IsActive     = true;
                    model.PasswordSalt = FDIUtils.CreateSaltKey(5);
                    model.PassWord     = FDIUtils.CreatePasswordHash(model.PassWord ?? "ssc123456", model.PasswordSalt);
                    if (!string.IsNullOrEmpty(NoteCate))
                    {
                        var customerCare = new Customer_Care
                        {
                            Note     = NoteCate,
                            AgencyId = AgencyId
                        };
                        model.Customer_Care.Add(customerCare);
                    }
                    _da.Add(model);
                    _da.Save();
                }
                catch (Exception ex)
                {
                    msg.Erros   = true;
                    msg.Message = "Thêm mới thất bại.";
                }
                break;

            case ActionType.Edit:
                try
                {
                    model = _da.GetById(ArrId.FirstOrDefault());
                    var birth  = Request["Birthday_"];
                    var serial = Request["CardSerial"];
                    var pin    = Request["PinCard"];
                    model.Birthday = ConvertDate.TotalSeconds(ConvertUtil.ToDateTime(birth));
                    var phone = model.Phone;
                    UpdateModel(model);
                    if (!model.CardID.HasValue && !string.IsNullOrEmpty(serial))
                    {
                        var carditem = _da.GetCardItem(serial, pin);
                        if (carditem != null)
                        {
                            model.CardID = carditem.ID;
                        }
                    }
                    if (!string.IsNullOrEmpty(model.PassWord))
                    {
                        model.PassWord = FDIUtils.CreatePasswordHash(model.PassWord, model.PasswordSalt);
                    }
                    model.Phone = phone;
                    _da.Save();
                    msg.Message = "Cập nhật dữ liệu thành công";
                }
                catch (Exception ex)
                {
                    msg.Erros   = true;
                    msg.Message = "Dữ liệu chưa được cập nhật";
                    Log2File.LogExceptionToFile(ex);
                }
                break;

            case ActionType.Delete:
                try
                {
                    var lst = _da.GetListByArrId(ArrId);
                    foreach (var item in lst)
                    {
                        item.IsDelete = true;
                    }
                    _da.Save();
                    msg.Message = "Xóa dữ liệu thành công";
                }
                catch (Exception ex)
                {
                    msg.Erros   = true;
                    msg.Message = "Dữ liệu chưa được xóa";
                    Log2File.LogExceptionToFile(ex);
                }
                break;

            default:
                msg.Message = "Không có hành động nào được thực hiện.";
                msg.Erros   = true;
                break;
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
Esempio n. 10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="key"></param>
        /// <param name="mobile">UserName</param>
        /// <param name="mobile">SĐT3G</param>
        /// <param name="pass">Mật khẩu</param>
        /// <param name="address">Địa chỉ</param>
        /// <returns></returns>
        public ActionResult Addapp(string mobile, string pass, string address, string name, string email)
        {
            int gid  = 3;
            var objr = new DNUserAppItem
            {
                UserName      = mobile,
                EnterprisesID = 3,
                Status        = 0
            };

            try
            {
                if (string.IsNullOrEmpty(mobile))
                {
                    return(Json(new BaseResponse <AgencyItem>()
                    {
                        Erros = true, Message = "Số điện thoại không được để trống"
                    }));
                }
                if (string.IsNullOrEmpty(pass))
                {
                    return(Json(new BaseResponse <AgencyItem>()
                    {
                        Erros = true, Message = "Mật khẩu không được để trống"
                    }));
                }
                if (_daUserDa.CheckUserName(mobile, true))
                {
                    return(Json(new BaseResponse <AgencyItem>()
                    {
                        Erros = true, Message = "Số điện thoại đã tồn tại"
                    }));
                }

                var daten = DateTime.Now;
                var date  = daten.TotalSeconds();
                var obj   = new DN_Agency
                {
                    Address      = address,
                    FullName     = name,
                    Name         = mobile,
                    Phone        = mobile,
                    GroupID      = gid,
                    EnterpriseID = 3,
                    IsShow       = true,
                    IsDelete     = false,
                    IsLock       = false,
                    IsOut        = false,
                    IsFdi        = false,
                    CreateDate   = date,
                    WalletValue  = 0,
                    CashOut      = 0,
                    Email        = email
                };
                _da.Add(obj);
                _da.Save();
                if (obj.GroupID > 0)
                {
                    _da.InsertDNModule(obj.GroupID, obj.ID);
                }
                var saltKey          = FDIUtils.CreateSaltKey(5);
                var sha1PasswordHash = FDIUtils.CreatePasswordHash(pass, saltKey);
                var user             = new DN_Users
                {
                    UserId          = Guid.NewGuid(),
                    PasswordSalt    = saltKey,
                    Password        = sha1PasswordHash,
                    UserName        = mobile,
                    LoweredUserName = name,
                    Email           = pass,
                    Address         = address,
                    AgencyID        = obj.ID,
                    Mobile          = mobile,
                    IsApproved      = true,
                    IsLockedOut     = false,
                    CreateDate      = date,
                    IsDeleted       = false,
                    IsAgency        = true
                };
                _daUserDa.Add(user);
                _daUserDa.Save();
                var role = new DN_Roles {
                    RoleId = Guid.NewGuid(), RoleName = "Admin", LoweredRoleName = "admin", AgencyID = obj.ID, Description = "Quản trị"
                };
                _darRoleDa.Add(role);
                var dnUsersInRoles = new DN_UsersInRoles
                {
                    UserId      = user.UserId,
                    AgencyID    = obj.ID,
                    DateCreated = date,
                    IsDelete    = false
                };
                role.DN_UsersInRoles.Add(dnUsersInRoles);
                _darRoleDa.Save();

                var result = new BaseResponse <AgencyItem>()
                {
                    Erros = false,
                };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                Log2File.LogExceptionToFile(ex);
            }
            return(Json(new BaseResponse <AgencyItem>()
            {
                Erros = false
            }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 11
0
        public ActionResult Actions()
        {
            var msg         = new JsonMessage();
            var enterprises = new DN_Enterprises();
            List <DN_Enterprises> ltsEnterprises;
            StringBuilder         stbMessage;
            var dateStart = Request["_DateStart"];
            var dateEnd   = Request["_DateEnd"];
            var pass      = Request["PasswordNew"];
            var groupId   = Request["GroupId"];
            var images    = Request["Value_DefaultImages"];

            switch (DoAction)
            {
            case ActionType.Add:
                try
                {
                    UpdateModel(enterprises);
                    if (!string.IsNullOrEmpty(dateStart) && !string.IsNullOrEmpty(dateEnd))
                    {
                        enterprises.DateStart = dateStart.StringToDecimal();
                        enterprises.DateEnd   = dateEnd.StringToDecimal();
                    }
                    enterprises.DateCreated = DateTime.Now.TotalSeconds();
                    if (!string.IsNullOrEmpty(pass))
                    {
                        var saltKey          = FDIUtils.CreateSaltKey(5);
                        var sha1PasswordHash = FDIUtils.CreatePasswordHash(saltKey, pass);
                        enterprises.PasswordSalt = saltKey;
                        enterprises.Password     = sha1PasswordHash;
                    }
                    enterprises.ST_Group  = _enterprisesDa.GetListGroupByArrID(FDIUtils.StringToListInt(groupId));
                    enterprises.IsDeleted = false;
                    _enterprisesDa.Add(enterprises);
                    _enterprisesDa.Save();
                    msg = new JsonMessage
                    {
                        Erros   = false,
                        ID      = enterprises.ID.ToString(),
                        Message = string.Format("Đã thêm mới hành động: <b>{0}</b>", Server.HtmlEncode(enterprises.Name))
                    };
                }
                catch (Exception ex)
                {
                    LogHelper.Instance.LogError(GetType(), ex);
                }
                break;

            case ActionType.Edit:
                try
                {
                    enterprises = _enterprisesDa.GetById(ArrId.FirstOrDefault());
                    UpdateModel(enterprises);
                    if (!string.IsNullOrEmpty(dateStart) && !string.IsNullOrEmpty(dateEnd))
                    {
                        enterprises.DateStart = dateStart.StringToDecimal();
                        enterprises.DateEnd   = dateEnd.StringToDecimal();
                    }
                    if (!string.IsNullOrEmpty(pass))
                    {
                        var sha1PasswordHash = FDIUtils.CreatePasswordHash(enterprises.PasswordSalt, pass);
                        enterprises.Password = sha1PasswordHash;
                    }
                    enterprises.ST_Group.Clear();
                    enterprises.ST_Group = _enterprisesDa.GetListGroupByArrID(FDIUtils.StringToListInt(groupId));
                    _enterprisesDa.Save();
                    msg = new JsonMessage
                    {
                        Erros   = false,
                        ID      = enterprises.ID.ToString(),
                        Message = string.Format("Đã cập nhật chuyên mục: <b>{0}</b>", Server.HtmlEncode(enterprises.Name))
                    };
                }
                catch (Exception ex)
                {
                    LogHelper.Instance.LogError(GetType(), ex);
                }
                break;

            case ActionType.Delete:
                ltsEnterprises = _enterprisesDa.GetListByArrId(Request["itemID"]);
                stbMessage     = new StringBuilder();
                foreach (var item in ltsEnterprises)
                {
                    item.IsDeleted = true;
                    stbMessage.AppendFormat("Đã xóa chuyên mục <b>{0}</b>.<br />", Server.HtmlEncode(item.Name));
                }
                msg.ID = string.Join(",", ArrId);
                _enterprisesDa.Save();
                msg.Message = stbMessage.ToString();
                break;

            case ActionType.Show:
                ltsEnterprises = _enterprisesDa.GetListByArrId(Request["itemID"]).Where(o => o.IsShow != null && !o.IsShow.Value).ToList();     //Chỉ lấy những đối tượng ko được hiển thị
                stbMessage     = new StringBuilder();
                foreach (var item in ltsEnterprises)
                {
                    item.IsShow = true;
                    stbMessage.AppendFormat("Đã hiển thị chuyên mục <b>{0}</b>.<br />", Server.HtmlEncode(item.Name));
                }
                _enterprisesDa.Save();
                msg.ID      = string.Join(",", ltsEnterprises.Select(o => o.ID));
                msg.Message = stbMessage.ToString();
                break;

            case ActionType.Hide:
                ltsEnterprises = _enterprisesDa.GetListByArrId(Request["itemID"]).Where(o => o.IsShow != null && o.IsShow.Value).ToList();     //Chỉ lấy những đối tượng được hiển thị
                stbMessage     = new StringBuilder();
                foreach (var item in ltsEnterprises)
                {
                    item.IsShow = false;
                    stbMessage.AppendFormat("Đã ẩn chuyên mục <b>{0}</b>.<br />", Server.HtmlEncode(item.Name));
                }
                _enterprisesDa.Save();
                msg.ID      = string.Join(",", ltsEnterprises.Select(o => o.ID));
                msg.Message = stbMessage.ToString();
                break;
            }

            if (string.IsNullOrEmpty(msg.Message))
            {
                msg.Message = "Không có hành động nào được thực hiện.";
                msg.Erros   = true;
            }

            return(Json(msg, JsonRequestBehavior.AllowGet));
        }