protected void btnSaveSystemUser_Click(object sender, DirectEventArgs e)
 {
     try
     {
         SystemUserWrapper obj = SystemUserWrapper.FindById(int.Parse(hidSystemUserID.Text.Trim()));
         obj.UserName  = this.txtUserName.Text.Trim();
         obj.UserEmail = this.txtUserEmail.Text.Trim();
         obj.Comments  = this.txtComments.Text.Trim();
         object did = hiddenDepartment1.Value;
         if (did != null)
         {
             string sdid = did.ToString();
             if (!string.IsNullOrEmpty(sdid))
             {
                 SystemDepartmentWrapper departmentWrapper = SystemDepartmentWrapper.FindById(Convert.ToInt32(sdid));
                 if (departmentWrapper != null)
                 {
                     obj.DepartmentID = departmentWrapper;
                 }
             }
         }
         SystemUserWrapper.Update(obj);
         winSystemUserEdit.Hide();
         ResourceManager.AjaxSuccess = true;
     }
     catch (Exception ex)
     {
         ResourceManager.AjaxSuccess      = false;
         ResourceManager.AjaxErrorMessage = "错误信息:" + ex.Message;
         return;
     }
 }
        protected void btnSaveSystemUser_Click(object sender, DirectEventArgs e)
        {
            try
            {
                SystemUserWrapper obj = SystemUserWrapper.FindById(int.Parse(hidSystemUserID.Text.Trim()));



                obj.UserName  = txtUserName.Text.Trim();
                obj.UserEmail = txtUserEmail.Text.Trim();
                obj.Comments  = txtComments.Text.Trim();



                SystemUserWrapper.Update(obj);
                winSystemUserEdit.Hide();
                ResourceManager.AjaxSuccess = true;
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = "Error Message :" + ex.Message;
                return;
            }
        }
        public void Show(int id)
        {
            try
            {
                SystemUserWrapper obj = SystemUserWrapper.FindById(id);

                if (obj != null)
                {
                    txtUserName.Text  = Convert.ToString(obj.UserName);
                    txtUserEmail.Text = Convert.ToString(obj.UserEmail);
                    txtComments.Text  = Convert.ToString(obj.Comments);

                    hidSystemUserID.Text = id.ToString();



                    winSystemUserEdit.Show();
                }
                else
                {
                    ResourceManager.AjaxSuccess      = false;
                    ResourceManager.AjaxErrorMessage = "Error Message : Data is not exist!";
                    return;
                }
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = "Error Message : " + ex.Message;
                return;
            }
        }
        public void Show(int id)
        {
            try
            {
                SystemUserWrapper obj = SystemUserWrapper.FindById(id);

                if (obj != null)
                {
                    this.txtUserName.Text  = obj.UserName.ToString();
                    this.txtUserEmail.Text = obj.UserEmail.ToString();
                    this.txtComments.Text  = obj.Comments.ToString();

                    hidSystemUserID.Text = id.ToString();


                    winSystemUserEdit.Show();
                }
                else
                {
                    ResourceManager.AjaxSuccess      = false;
                    ResourceManager.AjaxErrorMessage = "错误信息:数据不存在";
                    return;
                }
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = "错误信息:" + ex.Message;
                return;
            }
        }
        protected void Store1_OnRefreshData(object sender, StoreRefreshDataEventArgs e)
        {
            SystemUserWrapper        systemUserWrapper = SystemUserWrapper.FindById(UserID);
            List <SystemRoleWrapper> list1             = SystemRoleWrapper.FindAll();                                 //得到所有的角色
            List <string>            list2             = SystemUserWrapper.GetUserAssignedRoleIDs(systemUserWrapper); //得到用户的所有角色编号
            List <SystemRoleWrapper> list3             = list1.FindAll(p => !list2.Contains(p.RoleID.ToString()));

            Store1.DataSource = list3;
            Store1.DataBind();
        }
        private void InitStore1()
        {
            SystemUserWrapper        systemUserWrapper = SystemUserWrapper.FindById(UserID);
            List <SystemRoleWrapper> list1             = SystemRoleWrapper.FindAll();                                 //得到所有的角色
            List <string>            list2             = SystemUserWrapper.GetUserAssignedRoleIDs(systemUserWrapper); //得到用户的所有角色编号
            List <SystemRoleWrapper> list3             = list1.FindAll(p => !list2.Contains(p.RoleID.ToString()));

            Store1.DataSource = list3;
            Store1.DataBind();
        }
        private void InitStore2()
        {
            SystemUserWrapper        systemUserWrapper = SystemUserWrapper.FindById(UserID);
            List <string>            list2             = SystemUserWrapper.GetUserAssignedRoleIDs(systemUserWrapper);
            List <SystemRoleWrapper> list3             = new List <SystemRoleWrapper>();

            foreach (string s in list2)
            {
                list3.Add(SystemRoleWrapper.FindById(Int32.Parse(s)));
            }
            Store2.DataSource = list3;
            Store2.DataBind();
        }
        protected void Store2_OnRefreshData(object sender, StoreRefreshDataEventArgs e)
        {
            SystemUserWrapper        systemUserWrapper = SystemUserWrapper.FindById(UserID);
            List <string>            list2             = SystemUserWrapper.GetUserAssignedRoleIDs(systemUserWrapper);
            List <SystemRoleWrapper> list3             = new List <SystemRoleWrapper>();

            foreach (string s in list2)
            {
                list3.Add(SystemRoleWrapper.FindById(Int32.Parse(s)));
            }
            Store2.DataSource = list3;
            Store2.DataBind();
        }
        protected void btnChangePassword_Click(object sender, DirectEventArgs e)
        {
            if (UserID != 0)
            {
                string loginID = SystemUserWrapper.FindById(UserID).UserLoginID;
                if (!((NHibernateMembershipProvider)Membership.Provider).ChangePassword(loginID, this.txtNewPassword.Text.Trim()))
                {
                    ResourceManager.AjaxSuccess      = false;
                    ResourceManager.AjaxErrorMessage = "Change Password Failed!";
                    return;
                }
            }

            ResourceManager.AjaxSuccess = true;
        }
        public static void LogOpOther(WrapperType auditableData)
        {
            try
            {
                SystemVersionWrapper systemVersion = null;

                if (systemVersion == null)
                {
                    systemVersion = SaveNewVersion(auditableData);
                }

                SystemLogWrapper log = new SystemLogWrapper();
                log.LogDate = ValueConvertUtil.ConvertNullableValue(auditableData.GetDataLastModifyAt(), System.DateTime.Now);

                SystemUserWrapper opUser = null;

                if (auditableData.GetDataLastModifyBy().HasValue)
                {
                    opUser = SystemUserWrapper.FindById(auditableData.GetDataLastModifyBy().Value);
                }

                log.LogDescrption = auditableData.GetDataLastModifyComment();

                log.LogLevel          = SystemLogWrapper.SysteLogLevel.Info;
                log.LogRelateDateTime = auditableData.GetDataLastModifyAt();
                log.LogRelateUserID   = auditableData.GetDataLastModifyBy();

                if (opUser != null)
                {
                    log.LogRelateUserName = opUser.UserLoginID;
                }
                else
                {
                    log.LogRelateUserName = "";
                }

                log.ParentDataType = auditableData.GetType().ToString();
                log.ParentDataID   = auditableData.GetDataLastModifyBy();
                log.LogSource      = "Operation";
                log.LogType        = SystemLogWrapper.SysteLogType.OperationLog;

                SystemLogWrapper.Save(log);
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
            }
        }
 public void LockUser(int id)
 {
     try
     {
         SystemUserWrapper user = SystemUserWrapper.FindById(id);
         if (user != null)
         {
             user.IsLockedOut = !user.IsLockedOut;
             SystemUserWrapper.Update(user);
         }
     }
     catch (Exception ex)
     {
         ResourceManager.AjaxSuccess      = false;
         ResourceManager.AjaxErrorMessage = "Error Message:" + ex.Message;
     }
 }
Пример #12
0
 public void LockUser(int id)
 {
     try
     {
         SystemUserWrapper user = SystemUserWrapper.FindById(id);
         if (user != null)
         {
             user.IsLockedOut = !user.IsLockedOut;
             SystemUserWrapper.Update(user);
         }
     }
     catch (Exception ex)
     {
         ResourceManager.AjaxSuccess      = false;
         ResourceManager.AjaxErrorMessage = string.Format(this.GetGlobalResourceObject("GlobalResource", "msgServerErrorMsg").ToString(), ex.Message);
     }
 }
Пример #13
0
 private static void LogNewRecord(WrapperType wrapperType, int userID, DateTime dateTime, string opComment, object id)
 {
     try
     {
         if (userID == 0)
         {
             SystemLogWrapper.LogUserOperationAction(opComment, HttpUtil.GetIP(HttpContext.Current.Request), dateTime, typeof(WrapperType).Name, (int)id);
         }
         else
         {
             SystemLogWrapper.LogUserOperationAction(SystemUserWrapper.FindById(userID), opComment, HttpUtil.GetIP(HttpContext.Current.Request), dateTime, typeof(WrapperType).Name, (int)id);
         }
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
     }
 }
 public void Save_UserRole(string json)
 {
     try
     {
         List <SystemRoleWrapper> selectIDs = JSON.Deserialize <List <SystemRoleWrapper> >(json);
         List <String>            list      = new List <string>();
         foreach (SystemRoleWrapper row in selectIDs)
         {
             list.Add(row.RoleID.ToString());
         }
         SystemUserWrapper.PatchAssignUserRoles(SystemUserWrapper.FindById(UserID), list);
     }
     catch (Exception ex)
     {
         ResourceManager.AjaxSuccess      = false;
         ResourceManager.AjaxErrorMessage = string.Format(this.GetGlobalResourceObject("GlobalResource", "msgServerErrorMsg").ToString(), ex.Message);
     }
 }
Пример #15
0
 public void Save_UserGroup(string json)
 {
     try
     {
         KeyValuePair <string, string>[] selectIDs = JSON.Deserialize <KeyValuePair <string, string>[]>(json);
         List <String> list = new List <string>();
         foreach (KeyValuePair <string, string> row in selectIDs)
         {
             list.Add(row.Key);
         }
         SystemUserWrapper.PatchAssignUserUserGroups(SystemUserWrapper.FindById(UserID), list);
     }
     catch (Exception ex)
     {
         ResourceManager.AjaxSuccess      = false;
         ResourceManager.AjaxErrorMessage = "Error Message:" + ex.Message;
     }
 }
        protected void btnSaveSPSClient_Click(object sender, DirectEventArgs e)
        {
            try
            {
                SPSClientWrapper obj = SPSClientWrapper.FindById(int.Parse(hidId.Text.Trim()));

                SystemUserWrapper clientUser = SystemUserWrapper.FindById(obj.UserID);

                if (clientUser.UserLoginID != this.txtUserID.Text.Trim())
                {
                    if (SystemUserWrapper.FindByLoginID(this.txtUserID.Text.Trim()) != null)
                    {
                        ResourceManager.AjaxSuccess      = false;
                        ResourceManager.AjaxErrorMessage = "错误信息:用户已存在。";
                    }
                }


                clientUser.UserLoginID = this.txtUserID.Text.Trim();

                SPSClientWrapper.Update(obj);

                if (this.chkChangePassword.Checked && !string.IsNullOrEmpty(this.txtUserPasword.Text.Trim()))
                {
                    if (!((NHibernateMembershipProvider)Membership.Provider).ChangePassword(clientUser.UserLoginID, this.txtUserPasword.Text.Trim()))
                    {
                        ResourceManager.AjaxSuccess      = false;
                        ResourceManager.AjaxErrorMessage = "Change Password Failed!";
                        return;
                    }
                }



                winSPClientChangeUserLoginInfo.Hide();
                ResourceManager.AjaxSuccess = true;
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = "Error Message:" + ex.Message;
                return;
            }
        }
        public void DeleteRecord(int id)
        {
            try
            {
                SystemUserWrapper user = SystemUserWrapper.FindById(id);

                if (user != null)
                {
                    user.IsApproved = false;
                    SystemUserWrapper.Update(user);
                }

                ScriptManager.AjaxSuccess = true;
            }
            catch (Exception ex)
            {
                ScriptManager.AjaxSuccess      = false;
                ScriptManager.AjaxErrorMessage = string.Format(ex.Message);
                return;
            }
        }
Пример #18
0
        public override MembershipUser GetUser(object providerUserKey, bool userIsOnline)
        {
            if (providerUserKey == null)
            {
                throw new ArgumentNullException("providerUserKey");
            }
            SystemUserWrapper user = SystemUserWrapper.FindById(providerUserKey);

            if (user == null)
            {
                throw NhibernateMembershipProviderExceptionUtil.NewProviderException(this,
                                                                                     NHibernateProviderSR.
                                                                                     User_UnableToGet);
            }

            if (userIsOnline)
            {
                UpdateLastActivityDate(user.UserName);
            }

            return(user.ToMembershipUser(Name));
        }
        public void LockLoginUser(int id, bool isLock)
        {
            try
            {
                SPClientWrapper clientWrapper = SPClientWrapper.FindById(id);

                SystemUserWrapper user = SystemUserWrapper.FindById(clientWrapper.UserID);

                if (user != null)
                {
                    user.IsLockedOut = !user.IsLockedOut;
                    SystemUserWrapper.Update(user);
                }

                ScriptManager.AjaxSuccess = true;
            }
            catch (Exception ex)
            {
                ScriptManager.AjaxSuccess      = false;
                ScriptManager.AjaxErrorMessage = string.Format(ex.Message);
                return;
            }
        }
        public void Show(int id)
        {
            try
            {
                SPSClientWrapper obj = SPSClientWrapper.FindById(id);

                if (obj != null)
                {
                    this.txtName.Text = ValueConvertUtil.ConvertStringValue(obj.Name);

                    SystemUserWrapper clientUser = SystemUserWrapper.FindById(obj.UserID);

                    this.txtUserID.Text = clientUser.UserLoginID;

                    chkChangePassword.Checked = false;

                    this.txtUserPasword.Text = "";

                    hidId.Text = id.ToString();


                    winSPClientChangeUserLoginInfo.Show();
                }
                else
                {
                    ResourceManager.AjaxSuccess      = false;
                    ResourceManager.AjaxErrorMessage = "ErrorMessage:Data does not exist";
                    return;
                }
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = "ErrorMessage:" + ex.Message;
                return;
            }
        }
        public void Show(int id)
        {
            try
            {
                SystemUserWrapper obj = SystemUserWrapper.FindById(id);

                if (obj != null)
                {
                    this.txtUserName.Text  = Convert.ToString(obj.UserName);
                    this.txtUserEmail.Text = Convert.ToString(obj.UserEmail);
                    this.txtComments.Text  = Convert.ToString(obj.Comments);

                    hidSystemUserID.Text = id.ToString();
                    if (obj.DepartmentID == null)
                    {
                        DropDownField1.SetValue("", "");
                    }
                    else
                    {
                        DropDownField1.SetValue(obj.DepartmentID.DepartmentNameEn, obj.DepartmentID.DepartmentID.ToString());
                    }
                    winSystemUserEdit.Show();
                }
                else
                {
                    ResourceManager.AjaxSuccess      = false;
                    ResourceManager.AjaxErrorMessage = "错误信息:Data is not exist!";
                    return;
                }
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = "错误信息:" + ex.Message;
                return;
            }
        }
        public static int GetClientIDByUserID(int userId)
        {
            SystemUserWrapper user = SystemUserWrapper.FindById(userId);

            return(ConvertEntityToWrapper(businessProxy.GetClientByUserID(userId)).Id);
        }