Ejemplo n.º 1
0
        public ActionResult DoAddcustomer(UserInfo userInfo, string GroupId)
        {
            var result = new ActionBusinessResult();

            try
            {
                var userBL = new UserBL();
                userInfo.CreatedBy = SessionData.CurrentUser.Username;
                result             = userBL.AddUser(userInfo, GroupId);
                string _pass = userInfo.Password;
                if (result.IsActionSuccess == true)
                {
                    Email_Info _Email_Info = new Email_Info
                    {
                        EmailFrom    = EmailHelper.EmailOriginal.EMailFrom,
                        Pass         = EmailHelper.EmailOriginal.PassWord,
                        Display_Name = EmailHelper.EmailOriginal.DisplayName,

                        EmailTo       = userInfo.Email,
                        EmailCC       = "",
                        Subject       = "Email thông báo đăng ký mở tài khoản thành công",
                        Content       = "Dear " + userInfo.FullName + ", Quí khách đăng ký thành công tài khoản username:"******" password:"******"\n quí khách vui lòng truy cập vào địa chỉ <a href='http://pathlaw.net/vi-vn/account/login'>http://pathlaw.net/vi-vn/account/login</a> để đổi mật khẩu của tài khoản. \n cảm ơn quí khách hàng. ",
                        LstAttachment = new List <string>(),
                    };

                    CommonFunction.AppsCommon.EnqueueSendEmail(_Email_Info);
                }
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(Json(new { result = result.ToJson() }));
        }
Ejemplo n.º 2
0
        public ActionResult Login(string userName, string password, string returnUrl = "")
        {
            if (SessionData.CurrentUser != null)
            {
                return(Json(new { redirectTo = SessionData.CurrentUser.DefaultHomePage }));
            }
            string language = AppsCommon.GetCurrentLang();
            var    result   = new ActionBusinessResult();

            try
            {
                var userBL = new UserBL();
                result = userBL.DoLoginAccount(userName, password, language);
                if (result.IsActionSuccess)
                {
                    var ipAddress = HttpHelper.GetClientIPAddress(System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]);
                    FileHelper.WriteFileLogin(CommonVariables.KnFileLogin, userName, ipAddress);
                    userBL.CurrentUserInfo.Language         = language;
                    SessionData.CurrentUser                 = userBL.CurrentUserInfo;
                    SessionData.CurrentUser.DefaultHomePage = IdentityRequest.GetDefaultPageForAccountLogged();
                    SessionData.CurrentUser.CurrentDate     = CommonFuc.TruncDate();

                    var urlContinue = SessionData.CurrentUser.DefaultHomePage;
                    if (!string.IsNullOrEmpty(returnUrl))
                    {
                        urlContinue = returnUrl;
                    }
                    if (userBL.CurrentUserInfo.loginfirst == 0 && userName != "SuperAdmin")
                    {
                        if (WebApps.Session.SessionData.CurrentUser.Type == (int)CommonEnums.UserType.Customer)
                        {
                            urlContinue = "/customer/quan-ly-customer/get-view-to-edit-customer/" + userBL.CurrentUserInfo.Id.ToString();
                        }
                        else if (WebApps.Session.SessionData.CurrentUser.Type == (int)CommonEnums.UserType.Lawer)
                        {
                            urlContinue = "/luat-su/quan-ly-luat-su/get-view-to-edit-lawer/" + userBL.CurrentUserInfo.Id.ToString();
                        }
                        else
                        {
                            urlContinue = "/quan-tri-he-thong/quan-ly-nguoi-dung/get-view-to-edit-user/" + userBL.CurrentUserInfo.Id.ToString();
                        }
                    }

                    if (language != "VI_VN")
                    {
                        result.MessageCode = KnMessageCode.LoginSuccess_En;
                    }

                    return(Json(new { result = result.ToJson(), urlContinue }));
                }
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(Json(new { result = result.ToJson() }));
        }
Ejemplo n.º 3
0
        public ActionResult DoAddNewFunction(FunctionInfo functionInfo)
        {
            var result = new ActionBusinessResult();

            try
            {
                var functionBL = new FunctionBL();
                result = functionBL.AddFunction(functionInfo);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(Json(new { result = result.ToJson() }));
        }
Ejemplo n.º 4
0
        public ActionResult DoDeleteFunction(int functionId)
        {
            var result = new ActionBusinessResult();

            try
            {
                var functionBL = new FunctionBL();
                result = functionBL.DeleteFunction(functionId);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(Json(new { result = result.ToJson() }));
        }
Ejemplo n.º 5
0
        public ActionResult DoSetupFunctionsToGroup(int[] arrFunctionId, int groupId)
        {
            var result = new ActionBusinessResult();

            try
            {
                var groupBL = new GroupUserBL();
                result = groupBL.SetupFunctionsToGroup(groupId, arrFunctionId);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(Json(new { result = result.ToJson() }));
        }
Ejemplo n.º 6
0
        public ActionResult DoDeleteUser(int userId)
        {
            var result = new ActionBusinessResult();

            try
            {
                var userBL     = new UserBL();
                var modifiedBy = SessionData.CurrentUser.Username;
                result = userBL.DeleteUser(userId, modifiedBy);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(Json(new { result = result.ToJson() }));
        }
Ejemplo n.º 7
0
        public ActionResult DoEditUser(UserInfo userInfo, string GroupId)
        {
            var result = new ActionBusinessResult();

            try
            {
                var userBL = new UserBL();
                userInfo.ModifiedBy = SessionData.CurrentUser.Username;
                result = userBL.EditUser(userInfo, GroupId);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(Json(new { result = result.ToJson() }));
        }
Ejemplo n.º 8
0
        public ActionResult DoAddGroup(GroupUserInfo groupInfo)
        {
            var result = new ActionBusinessResult();

            try
            {
                var groupBL = new GroupUserBL();
                groupInfo.CreatedBy = SessionData.CurrentUser.Username;
                result = groupBL.AddGroup(groupInfo);
                MemoryData.ReloadGroup();
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(Json(new { result = result.ToJson() }));
        }
Ejemplo n.º 9
0
        public ActionResult DoDeleteGroup(int groupId)
        {
            var result = new ActionBusinessResult();

            try
            {
                var groupBL    = new GroupUserBL();
                var modifiedBy = SessionData.CurrentUser.Username;
                result = groupBL.DeleteGroup(groupId, modifiedBy);
                MemoryData.ReloadGroup();
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(Json(new { result = result.ToJson() }));
        }
Ejemplo n.º 10
0
        public ActionResult DoEditCustomer(UserInfo userInfo, string GroupId)
        {
            var result = new ActionBusinessResult();

            try
            {
                var userBL = new UserBL();
                userInfo.ModifiedBy = SessionData.CurrentUser.Username;
                result = userBL.EditUser(userInfo, GroupId);

                if (SessionData.CurrentUser != null && result.IsActionSuccess == true && userInfo.Id == SessionData.CurrentUser.Id)
                {
                    SessionData.CurrentUser.loginfirst = 1;
                }
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(Json(new { result = result.ToJson() }));
        }