Beispiel #1
0
        /// <summary>
        /// 根据用户名称和密码进行登录(去掉了异常处理)
        /// </summary>
        /// <param name="loginUser"></param>
        /// <param name="isPageLogin"></param>
        /// <returns></returns>
        private SsbUser Login(SsbUser loginUser, bool isPageLogin)
        {
            SsbUser result    = null;
            string  loginPass = loginUser.UserPwd;

            loginUser.UserPwd = null;
            var user = getUser(loginUser);

            if (user == null)
            {
                return(result);
            }
            if (string.IsNullOrWhiteSpace(user.UserPwd))
            {
                return(result);
            }
            var    decrypt   = AppBizFactory.CreateInstance <IMcPassword>();
            string spassword = decrypt.DecryptString(user.UserPwd, string.Empty, Encoding.ASCII);

            if (loginPass.Trim() == spassword.Trim())
            {
                if (isPageLogin)
                {
                    LoginSuccess(user);
                }
                result = user;
                return(result);
            }
            return(result);
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="clearAuthentication"></param>
        /// <param name="user"></param>
        private void LogoutForWinCE(bool clearAuthentication, SsbUser user)
        {
            OperationContext context = OperationContext.Current;
            //获取传进的消息属性
            MessageProperties properties = context.IncomingMessageProperties;
            //获取消息发送的远程终结点IP和端口
            RemoteEndpointMessageProperty endpoint = properties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
            string IP = endpoint.Address;


            if (IP == "::1")
            {
                IP = "127.0.0.1";
            }
            SslLoginLog log = new SslLoginLog();

            log.UserId     = user == null ? -99 : user.ObjId;
            log.LoginIp    = IP;
            log.LogoutTime = DateTime.Now;
            this.UpdateUserLoginLog(log);
            if (clearAuthentication)
            {
                FormsAuthentication.SignOut();
                HttpContext.Current.Session.Clear();
            }
        }
Beispiel #3
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        ILoginLogManager loginLogManager = AppBizFactory.CreateInstance <ILoginLogManager>();

        #region 获取使用的数据版本(帐套)
        string version = this.ddlDbVersion.SelectedItem.Value;
        //保存当前用户使用的数据版本(帐套)
        Session["dbVersion"] = version;
        #endregion
        SsbUser currUser = new SsbUser();
        currUser.UserName = this.txtUserName.Text.Trim();
        currUser.UserPwd  = this.txtPassword.Text.Trim();
        currUser          = loginLogManager.Login(currUser);
        if (currUser != null)
        {
            //保存当前用户使用的数据版本(帐套)
            this.Data.User.UserId  = (int)currUser.ObjId;
            Session["MyReturnUrl"] = this.Request.Url.AbsolutePath;  //保存起始登录页的访问路径
            this.AppendWebLog("用户登陆成功", "UserId=" + this.Data.User.UserId);
            Response.Redirect("MainFrame.aspx");
        }
        else
        {
            this.cv.IsValid = false;
        }
    }
Beispiel #4
0
        /// <summary>
        /// 用户退出
        /// </summary>
        public void Logout(int userId)
        {
            SsbUser user = new SsbUser();

            user.ObjId = userId;
            user       = getUser(user);
            Logout(true, user);
        }
Beispiel #5
0
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        private SsbUser getUser(SsbUser user)
        {
            SsbUser result = this.userBasicService.GetEntityList(new SsbUser {
                UserName = user.UserName, DeleteFlag = 0
            }).FirstOrDefault();

            return(result);
        }
Beispiel #6
0
 /// <summary>
 /// 获取权限对应的用户
 /// </summary>
 /// <param name="role"></param>
 /// <param name="user"></param>
 /// <returns></returns>
 public IList <SsbUser> GetRoleUserList(SspRole role, SsbUser user)
 {
     Dictionary <string, object> where = new Dictionary <string, object>();
     where.Add("ObjId", role.ObjId.ToString());
     where.Add("UserName", user.UserName);
     where.Add("RealName", user.RealName);
     where.Add("RoleName", role.RoleName);
     return(this.GetEntityByStatement <SsbUser>("GetRoleUserList", where));
 }
    public object GridPanelBindData(string action, Dictionary <string, object> extraParams)
    {
        string useraction = hiddenAcitonId.Text;
        string user_name  = txt_user_name.Text;

        if (string.IsNullOrWhiteSpace(useraction))
        {
            return(new { data = new List <SsbUser>(), total = 0 });
        }
        IList <ViewUserAllAction> lstAction = sysUserAllActionManager.GetEntityList(new ViewUserAllAction()
        {
            ActionId = Convert.ToInt32(useraction)
        });
        IList <SsbUser> lst = new List <SsbUser>();

        foreach (ViewUserAllAction m in lstAction)
        {
            try
            { IList <SsbUser> userList = new List <SsbUser>();
              if (string.IsNullOrWhiteSpace(user_name))
              {
                  userList = basUserManager.GetEntityList(new SsbUser()
                    {
                        ObjId = (long)m.UserId
                    });
              }
              else
              {
                  userList = basUserManager.GetEntityList(new SsbUser()
                    {
                        ObjId = (long)m.UserId, UserName = user_name
                    });
              }
              if (userList.Count > 0)
              {
                  SsbUser u  = userList[0];
                  string  ss = m.M.ToString();
                  ss       = ss.Replace("0", "");
                  ss       = ss.Replace("1", "用户定义;");
                  ss       = ss.Replace("2", "用户角色;");
                  ss       = ss.Replace("3", "部门权限;");
                  ss       = ss.Replace("4", "部门角色;");
                  u.Remark = ss;
                  lst.Add(u);
              }
            }
            catch { }
        }
        return(new { data = lst, total = lst.Count });
    }
Beispiel #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!X.IsAjaxRequest)
     {
         int     userid = this.Data.User.UserId;
         SsbUser user   = ssbUserManager.GetEntityList(new SsbUser()
         {
             ObjId = userid
         })[0];
         txtUserCode.Text     = user.WorkBarcode;
         txtUserName.Text     = user.UserName;
         txtUserRealName.Text = user.RealName;
     }
 }
Beispiel #9
0
    public void commandcolumn_direct_edit(string obj_id)
    {
        #region 清空界面
        modify_objid.Text           = string.Empty;
        modify_user_code.Text       = string.Empty;
        modify_user_name.Text       = string.Empty;
        modify_real_name.Text       = string.Empty;
        modify_telNum.Text          = string.Empty;
        modify_dept.Text            = string.Empty;
        modify_work.Text            = string.Empty;
        modify_class.Text           = string.Empty;
        modify_shift.Text           = string.Empty;
        modify_workshop.Text        = string.Empty;
        modify_remark.Text          = string.Empty;
        hidden_modify_dept.Text     = string.Empty;
        hidden_modify_work.Text     = string.Empty;
        hidden_modify_workshop.Text = string.Empty;
        #endregion

        #region 获取信息
        SsbUser user = userManager.GetByObjId(Convert.ToInt32(obj_id));
        #endregion

        #region 设置界面
        modify_objid.Value     = user.ObjId;
        modify_user_name.Value = user.UserName;
        modify_real_name.Value = user.RealName;
        modify_sex.Select(user.Sex.ToString());
        modify_telNum.Value      = user.Telephone;
        modify_user_code.Value   = user.WorkBarcode;
        hidden_modify_dept.Value = user.DeptId;
        if (user.DeptId != null)
        {
            modify_dept.Value = deptManager.GetEntityList(new SsbDept()
            {
                ObjId = user.DeptId
            })[0].DeptName;
        }
        if (user.ClassId != null)
        {
            modify_class.Value = user.ClassId.ToString();
        }
        if (user.ShiftId != null)
        {
            modify_shift.Value = user.ShiftId.ToString();
        }
        modify_remark.Value = user.Remark;
        this.winModify.Show();
        #endregion
    }
Beispiel #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack && !X.IsAjaxRequest)
        {
            SetTaskCssColor();
            SsbUser user = ssbUserManager.GetEntityList(new SsbUser()
            {
                ObjId = this.Data.User.UserId
            }).FirstOrDefault();

            this.BorderPanelWest.Title = getDbVersion();
            this.mainTreePanel.Title   = "[" + user.UserName + "]";
        }
    }
Beispiel #11
0
        /// <summary>
        /// 登录成功
        /// </summary>
        /// <param name="user"></param>
        private void LoginSuccess(SsbUser user)
        {
            Logout(false, user);
            SslLoginLog loginlog = new SslLoginLog();

            loginlog.UserId     = user.ObjId;
            loginlog.LoginTime  = DateTime.Now;
            loginlog.LogoutTime = null;
            loginlog.LoginIp    = HttpContext.Current.Request.UserHostAddress;
            if (loginlog.LoginIp == "::1")
            {
                loginlog.LoginIp = "127.0.0.1";
            }
            TableViewServiceFactory.CreateInstance <ISslLoginLogService>().Insert(loginlog);
        }
Beispiel #12
0
    public object GridPanelBindUserData(string action, Dictionary <string, object> extraParams)
    {
        string roleid = hiddenRoleID.Text;

        IniDeptNode(roleid, TreePanel2);
        if (string.IsNullOrWhiteSpace(roleid))
        {
            return(null);
        }
        SspRole role = new SspRole();

        role.ObjId = int.Parse(roleid);
        SsbUser         user  = new SsbUser();
        IList <SsbUser> lst   = basUserManager.GetRoleUserList(role, user);
        int             total = lst.Count;

        return(new { data = lst, total });
    }
Beispiel #13
0
        private void LoginSuccessForWinCE(SsbUser user)
        {
            LogoutForWinCE(false, user);
            OperationContext context = OperationContext.Current;
            //获取传进的消息属性
            MessageProperties properties = context.IncomingMessageProperties;
            //获取消息发送的远程终结点IP和端口
            RemoteEndpointMessageProperty endpoint = properties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
            SslLoginLog loginlog = new SslLoginLog();

            loginlog.UserId     = user.ObjId;
            loginlog.LoginTime  = DateTime.Now;
            loginlog.LogoutTime = null;
            loginlog.LoginIp    = endpoint.Address;;
            if (loginlog.LoginIp == "::1")
            {
                loginlog.LoginIp = "172.0.0.1";
            }
            TableViewServiceFactory.CreateInstance <ISslLoginLogService>().Insert(loginlog);
        }
Beispiel #14
0
        /// <summary>
        /// 退出登录
        /// </summary>
        /// <param name="clearAuthentication"></param>
        /// <param name="user"></param>
        private void Logout(bool clearAuthentication, SsbUser user)
        {
            string IP = HttpContext.Current.Request.UserHostAddress;


            if (IP == "::1")
            {
                IP = "127.0.0.1";
            }
            SslLoginLog log = new SslLoginLog();

            log.UserId     = user == null ? -99 : user.ObjId;
            log.LogoutIp   = IP;
            log.LogoutTime = DateTime.Now;
            this.UpdateUserLoginLog(log);
            if (clearAuthentication)
            {
                FormsAuthentication.SignOut();
                HttpContext.Current.Session.Clear();
            }
        }
Beispiel #15
0
 /// <summary>
 /// 点击修改信息中保存按钮激发的事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void BtnModifySave_Click(object sender, EventArgs e)
 {
     try
     {
         if (string.IsNullOrWhiteSpace(modify_objid.Text))
         {
             X.Msg.Alert("提示", "编号不能为空!").Show();
             return;
         }
         int objid = Convert.ToInt32(modify_objid.Text);
         if (string.IsNullOrWhiteSpace(modify_user_name.Text))
         {
             X.Msg.Alert("提示", "用户名不能为空!").Show();
             return;
         }
         if (string.IsNullOrWhiteSpace(modify_user_code.Text))
         {
             X.Msg.Alert("提示", "用户工号不能为空!").Show();
             return;
         }
         if (userIsExist(objid, "UserName", modify_user_name.Text))
         {
             X.Msg.Alert("提示", "此用户名称已被使用!").Show();
             return;
         }
         if (userIsExist(objid, "WorkBarcode", modify_user_code.Text))
         {
             X.Msg.Alert("提示", "此用户工号已被使用!").Show();
             return;
         }
         string ss   = string.Empty;
         var    user = new SsbUser();
         user.WorkBarcode = modify_user_code.Text;
         user.UserName    = modify_user_name.Text;
         user.RealName    = modify_real_name.Text;
         user.Sex         = Convert.ToInt32(modify_sex.SelectedItem.Value);
         user.Telephone   = modify_telNum.Text;
         ss = hidden_modify_dept.Text;
         if (!string.IsNullOrWhiteSpace(ss))
         {
             user.DeptId = Convert.ToInt32(ss);
         }
         ss = hidden_modify_work.Text;
         if (!string.IsNullOrWhiteSpace(ss))
         {
             user.WorkId = Convert.ToInt32(ss);
         }
         ss = hidden_modify_workshop.Text;
         if (!string.IsNullOrWhiteSpace(ss))
         {
             user.WorkshopId = Convert.ToInt32(ss);
         }
         ss = modify_class.Text;
         if (!string.IsNullOrWhiteSpace(ss))
         {
             user.ClassId = Convert.ToInt32(modify_class.SelectedItem.Value);// Convert.ToInt32(hidden_shift_id.Text);
         }
         else
         {
             user.ClassId = null;
         }
         ss = modify_shift.Text;
         if (!string.IsNullOrWhiteSpace(ss))
         {
             user.ShiftId = Convert.ToInt32(modify_shift.SelectedItem.Value);// Convert.ToInt32(hidden_shift_id.Text);
         }
         else
         {
             user.ShiftId = null;
         }
         user.Remark = modify_remark.Text;
         userManager.Update(user, new SsbUser()
         {
             ObjId = objid
         });
         this.AppendWebLog("用户信息修改", "ObjId=" + objid);
         pageToolBar.DoRefresh();
         this.winModify.Close();
         X.Msg.Alert("操作", "保存成功").Show();
     }
     catch (Exception ex)
     {
         X.Msg.Alert("操作", "保存失败:" + ex).Show();
     }
 }
Beispiel #16
0
 /// <summary>
 /// 点击添加信息中保存按钮激发的事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void BtnAddSave_Click(object sender, DirectEventArgs e)
 {
     try
     {
         if (string.IsNullOrWhiteSpace(add_user_name.Text))
         {
             X.Msg.Alert("提示", "用户名不能为空!").Show();
             return;
         }
         if (string.IsNullOrWhiteSpace(add_user_code.Text))
         {
             X.Msg.Alert("提示", "用户工号不能为空!").Show();
             return;
         }
         if (userIsExist(null, "UserName", add_user_name.Text))
         {
             X.Msg.Alert("提示", "此用户名称已被使用!").Show();
             return;
         }
         if (userIsExist(null, "WorkBarcode", add_user_code.Text))
         {
             X.Msg.Alert("提示", "此用户工号已被使用!").Show();
             return;
         }
         string ss   = string.Empty;
         var    user = new SsbUser();
         user.WorkBarcode = add_user_code.Text;
         user.UserName    = add_user_name.Text;
         user.RealName    = add_real_name.Text;
         user.Sex         = Convert.ToInt32(add_sex.SelectedItem.Value);
         user.Telephone   = add_telNum.Text;
         ss = hidden_add_dept.Text;
         if (!string.IsNullOrWhiteSpace(ss))
         {
             user.DeptId = Convert.ToInt32(ss);
         }
         ss = hidden_add_work.Text;
         if (!string.IsNullOrWhiteSpace(ss))
         {
             user.WorkId = Convert.ToInt32(ss);
         }
         ss = hidden_add_workshop.Text;
         if (!string.IsNullOrWhiteSpace(ss))
         {
             user.WorkshopId = Convert.ToInt32(ss);
         }
         ss = add_class.Text;
         if (!string.IsNullOrWhiteSpace(ss))
         {
             user.ClassId = Convert.ToInt32(add_class.SelectedItem.Value);// Convert.ToInt32(hidden_shift_id.Text);
         }
         ss = add_shift.Text;
         if (!string.IsNullOrWhiteSpace(ss))
         {
             user.ShiftId = Convert.ToInt32(add_shift.SelectedItem.Value);// Convert.ToInt32(hidden_shift_id.Text);
         }
         user.Remark     = add_remark.Text;
         user.DeleteFlag = 0;
         userManager.Insert(user);
         this.AppendWebLog("用户信息添加", "用户名" + user.UserName);
         pageToolBar.DoRefresh();
         this.winAdd.Close();
         X.Msg.Alert("操作", "保存成功").Show();
     }
     catch (Exception ex)
     {
         X.Msg.Alert("操作", "保存失败:" + ex).Show();
     }
 }
Beispiel #17
0
 /// <summary>
 /// 根据用户名称和密码进行登录(去掉了异常处理)
 /// </summary>
 /// <param name="loginUser"></param>
 /// <returns></returns>
 public SsbUser Login(SsbUser loginUser)
 {
     return(Login(loginUser, true));
 }
Beispiel #18
0
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        int     userid = this.Data.User.UserId;
        SsbUser upuser = ssbUserManager.GetEntityList(new SsbUser()
        {
            ObjId = userid
        })[0];

        if (txtUserNewPassword1.Text.Trim().Length > 0)
        {
            if (txtUserNewPassword1.Text.Trim().Length == 0)
            {
                X.Msg.Show(new MessageBoxConfig
                {
                    Title   = "错误提示",
                    Message = "修改密码必须输入原密码!",
                    Buttons = MessageBox.Button.OK,
                    Icon    = MessageBox.Icon.ERROR
                }
                           );
                return;
            }
            if (txtUserNewPassword1.Text.Trim() != txtUserNewPassword2.Text.Trim())
            {
                X.Msg.Show(new MessageBoxConfig
                {
                    Title   = "错误提示",
                    Message = "修改密码必须输入原密码!",
                    Buttons = MessageBox.Button.OK,
                    Icon    = MessageBox.Icon.ERROR
                }
                           );
                return;
            }
            SsbUser user = ssbUserManager.GetEntityList(new SsbUser()
            {
                ObjId = userid
            })[0];
            var    dencrypt  = AppBizFactory.CreateInstance <IMcPassword>();
            string spassword = dencrypt.DecryptString(user.UserPwd.Trim(), string.Empty, Encoding.ASCII);
            if (spassword != txtUserPassword.Text)
            {
                X.Msg.Show(new MessageBoxConfig
                {
                    Title   = "错误提示",
                    Message = "原密码不正确!",
                    Buttons = MessageBox.Button.OK,
                    Icon    = MessageBox.Icon.ERROR
                });
                return;
            }
            var encrypt = AppBizFactory.CreateInstance <IMcPassword>();
            upuser.UserPwd = encrypt.EncryptString(txtUserNewPassword1.Text.Trim(), string.Empty, Encoding.ASCII);
        }
        upuser.RealName = txtUserRealName.Text == "" ? txtUserName.Text : txtUserRealName.Text;
        ssbUserManager.Update(upuser, new SsbUser()
        {
            ObjId = userid
        });
        txtUserPassword.Text     = string.Empty;
        txtUserNewPassword1.Text = string.Empty;
        txtUserNewPassword2.Text = string.Empty;
        X.Msg.Show(new MessageBoxConfig
        {
            Title   = "成功提示",
            Message = "用户信息修改成功!",
            Buttons = MessageBox.Button.OK,
            Icon    = MessageBox.Icon.INFO
        });
    }
Beispiel #19
0
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        private SsbUser getUser(SsbUser user)
        {
            SsbUser result = this.userBasicService.GetEntityList(user).FirstOrDefault();

            return(result);
        }
Beispiel #20
0
 /// <summary>
 /// 获取权限对应的用户
 /// </summary>
 /// <param name="role"></param>
 /// <param name="user"></param>
 /// <returns></returns>
 public IList <SsbUser> GetRoleUserList(SspRole role, SsbUser user)
 {
     return(this.businessService.GetRoleUserList(role, user));
 }
Beispiel #21
0
 public int Insert(SsbUser entity)
 {
     return(this.basicService.Insert(entity));
 }
Beispiel #22
0
 public int Update(SsbUser update, SsbUser where)
 {
     return(this.basicService.Update(update, where));
 }
Beispiel #23
0
 public IList <SsbUser> GetEntityList(SsbUser entity)
 {
     return(this.basicService.GetEntityList(entity));
 }