示例#1
0
        /// <summary>
        /// 设置个性签名
        /// </summary>
        /// <param name="loginName">登录名</param>
        /// <param name="signature">手机号</param>
        /// <returns></returns>
        public static OpResult SetSignature(string loginName, string signature)
        {
            var user = Find(o => o.CompanyId == Sys.SysCommonRules.CompanyId && o.LoginName.Equals(loginName, StringComparison.OrdinalIgnoreCase));

            if (user != null)
            {
                user.Signature = signature;
                var result = Update(user);
                if (!result.Successed)
                {
                    throw new MessageException("保存失败!");
                }
                result.Data = user;
                return(result);
            }
            else
            {
                var supp = SupplierService.Find(o => o.CompanyId == Sys.SysCommonRules.CompanyId && o.MasterAccount == loginName);
                if (supp != null)
                {
                    supp.Signature = signature;
                    var result = SupplierService.Update(supp);
                    if (!result.Successed)
                    {
                        throw new MessageException("保存失败!");
                    }
                    result.Data = supp;
                    return(result);
                }
            }
            throw new MessageException("登录用户不存在!");
        }
示例#2
0
        public static void UpdateHandsignOff(string loginName, string password)
        {
            if (loginName.IsNullOrEmpty())
            {
                throw new MessageException("帐号为空!");
            }
            if (password.IsNullOrEmpty())
            {
                throw new MessageException("手势密码为空!");
            }
            var user = Find(o => o.CompanyId == Sys.SysCommonRules.CompanyId && o.LoginName == loginName && o.Handsign == password);

            if (user != null)
            {
                user.Handsign = "";
                Update(user);
            }
            else
            {
                var supp = SupplierService.Find(o => o.CompanyId == Sys.SysCommonRules.CompanyId && o.MasterAccount == loginName && o.Handsign == password);
                if (supp != null)
                {
                    supp.Handsign = "";
                    SupplierService.Update(supp);
                }
                else
                {
                    throw new MessageException("帐号或密码错误!");
                }
            }
        }
示例#3
0
        public static string GetHandsign(string loginName, string password, ref bool isopen)
        {
            if (loginName.IsNullOrEmpty())
            {
                throw new MessageException("帐号为空!");
            }
            var user = Find(o => o.CompanyId == Sys.SysCommonRules.CompanyId && o.LoginName == loginName);

            if (user != null && !user.Handsign.IsNullOrEmpty())
            {
                isopen = true;
                if (!password.IsNullOrEmpty() && Security.MD5_Encrypt(password) != user.LoginPwd)
                {
                    throw new MessageException("密码不正确!");
                }
                return(user.Handsign);
            }
            else
            {
                var supp = SupplierService.Find(o => o.CompanyId == Sys.SysCommonRules.CompanyId && o.MasterAccount == loginName);
                if (supp != null && !supp.Handsign.IsNullOrEmpty())
                {
                    isopen = true;
                    if (!password.IsNullOrEmpty() && password != user.LoginPwd)
                    {
                        throw new MessageException("密码不正确!");
                    }
                    return(supp.Handsign);
                }
            }
            return("");
        }
示例#4
0
        public static void UpdatePassword(string loginName, string oldpassword, string newpassword)
        {
            if (loginName.IsNullOrEmpty())
            {
                throw new MessageException("帐号为空!");
            }
            if (oldpassword.IsNullOrEmpty())
            {
                throw new MessageException("原密码为空!");
            }
            if (newpassword.IsNullOrEmpty())
            {
                throw new MessageException("新密码为空!");
            }
            var old  = Security.MD5_Encrypt(oldpassword);
            var user = Find(o => o.CompanyId == Sys.SysCommonRules.CompanyId && o.LoginName == loginName && o.LoginPwd == old);

            if (user != null)
            {
                user.LoginPwd = Security.MD5_Encrypt(newpassword);
                Update(user);
            }
            else
            {
                var supp = SupplierService.Find(o => o.CompanyId == Sys.SysCommonRules.CompanyId && o.MasterAccount == loginName && o.MasterPwd == old);
                if (supp != null)
                {
                    supp.MasterPwd = Security.MD5_Encrypt(newpassword);
                    SupplierService.Update(supp);
                }
                else
                {
                    throw new MessageException("帐号或密码错误!");
                }
            }
        }