public AdminLoginEntity Login(string code, string password)
        {
            AdminLoginEntity _returnentity = new AdminLoginEntity();

            if (string.IsNullOrEmpty(code) || string.IsNullOrEmpty(password))
            {
                _returnentity.ResultCode = ((int)CommonStatus.LoginEmpty).ToString();
                _returnentity.ResultMsg  = EnumShow.Instance.GetEnumDes(CommonStatus.LoginEmpty);
                return(_returnentity);
            }
            SysUserEntity _entity = SysUserBLL.Instance.GetUserByUserCode(code);

            if (_entity == null)
            {
                _returnentity.ResultCode = ((int)CommonStatus.LoginNoMemCode).ToString();
                _returnentity.ResultMsg  = EnumShow.Instance.GetEnumDes(CommonStatus.LoginNoMemCode);
                return(_returnentity);
            }
            string passmd5 = CryptMD5.Encrypt(password);

            if (_entity.PassWord != passmd5)
            {
                _returnentity.ResultCode = ((int)CommonStatus.LoginError).ToString();
                _returnentity.ResultMsg  = EnumShow.Instance.GetEnumDes(CommonStatus.LoginError);
                return(_returnentity);
            }
            _returnentity.Member     = _entity;
            _returnentity.ResultCode = ((int)CommonStatus.Success).ToString();
            _returnentity.ResultMsg  = EnumShow.Instance.GetEnumDes(CommonStatus.Success);

            return(_returnentity);
        }
        private string ZhuTongKeJiSend(string AppId, string UserCode, string PassWord, string Url, string mobilestr, string msgbody)
        {
            string    datenowstr = DateTime.Now.ToString("yyyyMMddHHmmss");
            Hashtable _Pars      = new Hashtable();

            _Pars.Add("username", UserCode);
            _Pars.Add("password", CryptMD5.Encrypt(CryptMD5.Encrypt(PassWord.Trim()).ToLower() + datenowstr).ToLower());
            _Pars.Add("mobile", mobilestr);
            _Pars.Add("content", msgbody);
            _Pars.Add("tkey", datenowstr);
            _Pars.Add("productid", AppId);
            _Pars.Add("xh", "");
            string resultr = WebServiceClient.QueryPostWebService(Url, _Pars);

            return(resultr);
        }
Beispiel #3
0
        /// <summary>
        /// 助通科技
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static string ZhuTongKeJiSend(string mobilestr, string msgbody)
        {
            MobileMessageConfig config = ( MobileMessageConfig)SuperMarket.Core.ConfigCore.Instance.ConfigEntity.SMSConfigS.Where(x => x.Name == "ZhuTongKeJi");
            string    datenowstr       = DateTime.Now.ToString("yyyyMMddHHmmss");
            Hashtable _Pars            = new Hashtable();

            _Pars.Add("username", config.UserCode);
            _Pars.Add("password", CryptMD5.Encrypt(CryptMD5.Encrypt(config.PassWord.Trim()).ToLower() + datenowstr).ToLower());
            _Pars.Add("mobile", mobilestr);
            _Pars.Add("content", msgbody);
            _Pars.Add("tkey", datenowstr);
            _Pars.Add("productid", config.AppId);
            _Pars.Add("xh", "");
            string resultr = WebServiceClient.QueryPostWebService(config.Url, _Pars);

            return(resultr);
        }
        ///// <summary>
        ///// 修改密码
        ///// </summary>
        ///// <returns></returns>
        //public ActionResult ModifyPwd()
        //{
        //    long _key = QueryString.LongIntSafeQ("key");
        //    if (System.Web.HttpContext.Current.Session[CommonKey.FindPwdID] != null)
        //    {
        //        int _memid = Convert.ToInt32(System.Web.HttpContext.Current.Session[CommonKey.FindPwdID]);
        //        if (_memid > 0)
        //        {
        //            MemberEntity _entity = MemberBLL.Instance.GetMember(_memid);
        //            if (_entity.TimeStampCode == _key)
        //            {
        //                ViewBag.key = _key;
        //                return View();
        //            }
        //            return RedirectToAction("FindPwd");
        //        }
        //    }

        //    return RedirectToAction("FindPwd");

        //}


        /// <summary>
        /// 提交修改密码信息
        /// </summary>
        /// <returns></returns>
        public int SubmitPwdInfo()
        {
            string _password = FormString.SafeQ("newpassword");

            if (System.Web.HttpContext.Current.Session[CommonKey.FindPwdID] != null)
            {
                int _id = Convert.ToInt32(System.Web.HttpContext.Current.Session[CommonKey.FindPwdID]);
                if (_id > 0)
                {
                    MemberEntity _entity = MemberBLL.Instance.GetMember(_id);
                    _entity.PassWord = CryptMD5.Encrypt(_password);
                    return(MemberBLL.Instance.UpdateMember(_entity));
                }

                return(0);
            }
            return(0);
        }
Beispiel #5
0
        /// <summary>
        /// 插入一条记录到表SysUser,如果表中存在自增字段,则返回值为新记录的自增字段值,否则返回0
        /// </summary>
        /// <param name="db">数据库操作对象</param>
        /// <param name="sysUser">待插入的实体对象</param>
        public int AddSysUser(SysUserEntity entity)
        {
            string    sql = @"insert into SysUser( [UserCode],[UserName],[PassWord],[IsActive],[CreateTime],[UserLevel])VALUES
			            ( @UserCode,@UserName,@PassWord,@IsActive,@CreateTime,@UserLevel);
			SELECT SCOPE_IDENTITY();"            ;
            DbCommand cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "@UserCode", DbType.String, entity.UserCode);
            db.AddInParameter(cmd, "@UserName", DbType.String, entity.UserName);
            db.AddInParameter(cmd, "@PassWord", DbType.String, CryptMD5.Encrypt(entity.PassWord));
            db.AddInParameter(cmd, "@IsActive", DbType.Int32, entity.IsActive);
            db.AddInParameter(cmd, "@CreateTime", DbType.DateTime, entity.CreateTime);
            db.AddInParameter(cmd, "@UserLevel", DbType.Int32, entity.UserLevel);
            object identity = db.ExecuteScalar(cmd);

            if (identity == null || identity == DBNull.Value)
            {
                return(0);
            }
            return(Convert.ToInt32(identity));
        }
Beispiel #6
0
        /// <summary>
        /// 插入一条记录到表MemPWDModLog,如果表中存在自增字段,则返回值为新记录的自增字段值,否则返回0
        /// </summary>
        /// <param name="db">数据库操作对象</param>
        /// <param name="memPWDModLog">待插入的实体对象</param>
        public int AddMemPWDModLog(MemPWDModLogEntity entity)
        {
            string    sql = @"
 UPDATE dbo.[Member] SET [PassWord]=@NewPassWord  WHERE [Id]=@MemId;
insert into MemPWDModLog( [MemId],[PassWord],[NewPassWord],[ModifyTime],[IPAddress],[ClientType])VALUES
			            ( @MemId,@PassWord,@NewPassWord,@ModifyTime,@IPAddress,@ClientType);
			SELECT id from dbo.[Member] WHERE [Id]=@MemId"            ;
            DbCommand cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "@MemId", DbType.Int32, entity.MemId);
            db.AddInParameter(cmd, "@PassWord", DbType.String, entity.PassWord);
            db.AddInParameter(cmd, "@NewPassWord", DbType.String, CryptMD5.Encrypt(entity.NewPassWord));
            db.AddInParameter(cmd, "@ModifyTime", DbType.DateTime, entity.ModifyTime);
            db.AddInParameter(cmd, "@IPAddress", DbType.String, entity.IPAddress);
            db.AddInParameter(cmd, "@ClientType", DbType.Int32, entity.ClientType);
            object identity = db.ExecuteScalar(cmd);

            if (identity == null || identity == DBNull.Value)
            {
                return(0);
            }
            return(Convert.ToInt32(identity));
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="AppId"></param>
        /// <param name="PassWord"></param>
        /// <param name="Url"></param>
        /// <param name="mobilestr"></param>
        /// <param name="msgbody"></param>
        /// <param name="ext">营销短信传“1”</param>
        /// <returns></returns>
        private string ChuangShiManDaoSend(string AppId, string PassWord, string Url, string mobilestr, string msgbody, string ext = "")
        {
            Hashtable _Pars = new Hashtable();
            string    pwd   = CryptMD5.Encrypt(AppId + PassWord);

            _Pars.Add("sn", AppId);
            _Pars.Add("pwd", pwd);
            _Pars.Add("mobile", mobilestr);
            _Pars.Add("content", msgbody);
            _Pars.Add("ext", ext);
            _Pars.Add("stime", "");
            _Pars.Add("rrid", "");
            _Pars.Add("msgfmt", "");
            string resultr = WebServiceClient.QueryPostWebService(Url, _Pars);

            XmlDocument xDoc = new XmlDocument();

            xDoc.Load(new System.IO.MemoryStream(System.Text.Encoding.GetEncoding("UTF-8").GetBytes(resultr.Trim())));
            if (xDoc != null)
            {
                resultr = xDoc.GetElementsByTagName("string")[0].InnerText;
            }
            return(resultr);
        }
        public ResultObj Login(string unionid, string code, string password, int clienttype, string ipaddress)
        {
            ResultObj         _returnentity = new ResultObj();
            MemberLoginEntity _entity       = null;
            bool isweixin = true;

            if (!string.IsNullOrEmpty(unionid))
            {
                _entity = MemberBLL.Instance.GetLoginMemByMethod(unionid, LoginMethodEnum.WeChat);
            }
            if ((_entity == null || _entity.MemId == 0) && (string.IsNullOrEmpty(code) || string.IsNullOrEmpty(password)))
            {
                _returnentity.Status = (int)CommonStatus.LoginEmpty;
                return(_returnentity);
            }
            if (_entity == null || _entity.MemId == 0)
            {
                isweixin = false;
                _entity  = MemberBLL.Instance.GetLoginMemByMethod(code, LoginMethodEnum.Code);
            }
            if (_entity == null || _entity.MemId == 0)
            {
                isweixin = false;
                _entity  = MemberBLL.Instance.GetLoginMemByMethod(code, LoginMethodEnum.MobilePhone);
            }
            if (_entity == null || _entity.MemId == 0)
            {
                _returnentity.Status = (int)CommonStatus.LoginNoMemCode;
                return(_returnentity);
            }
            if (!isweixin)
            {
                string passmd5 = CryptMD5.Encrypt(password);
                if (_entity.PassWord != passmd5)
                {
                    _returnentity.Status = (int)CommonStatus.LoginError;
                    return(_returnentity);
                }
            }
            if (_entity.Status == (int)MemberStatus.IsLock)
            {
                _returnentity.Status = (int)CommonStatus.LoginStatusLock;
                return(_returnentity);
            }
            if (_entity.Status == (int)MemberStatus.WaitCheck)
            {
                _returnentity.Status = (int)CommonStatus.Success;
                _returnentity.Obj    = _entity;
                return(_returnentity);
            }
            _returnentity.Obj    = _entity;
            _returnentity.Status = (int)CommonStatus.Success;
            if (_entity.MemId > 0 && string.IsNullOrEmpty(_entity.WeChat) && !string.IsNullOrEmpty(unionid))
            {
                MemberBLL.Instance.BindMemWeChat(_entity.MemId, unionid, _entity.TimeStampTab);
            }

            //此处可以异步
            AddLoginLog(_entity.MemId, clienttype, ipaddress);
            _returnentity.Obj = MemberBLL.Instance.GetLoginMemByMethod(_entity.MemId.ToString(), LoginMethodEnum.MemId);
            return(_returnentity);
        }