public UsrDto RegisterSub(UsrDto dddd)
        {
            if (string.IsNullOrEmpty(dddd.LoginName) || string.IsNullOrEmpty(dddd.LoginPwd))
            {
                return new UsrDto {
                           Error = "用户名和密码不能为空"
                }
            }
            ;
            string selsql = @"select ID from huangguan_user where LoginName=N'{0}'"
                            .FormatStr(dddd.LoginName);
            DataTable dtq = MySqlDbHelper.ExecuteQuery(connCommonsStr, selsql);

            if (dtq.Rows.Count > 0)
            {
                return(new UsrDto {
                    Error = "用户名已经存在"
                });
            }
            else
            {
                var    md5       = EncryptHelper.GetEncryPwd(dddd.LoginPwd);
                Guid   id        = Guid.NewGuid();
                string insertsql = @"insert into huangguan_user(ID,LoginName,LoginPwd,NickName,UserPhone,RoleId,UserEmail,status,CreatedAt) 
values('{0}',N'{1}','{2}',N'{3}','{4}','{5}','{6}','{7}','{8}')".FormatStr(id, dddd.LoginName, md5, dddd.LoginName, dddd.UserPhone, 2, dddd.UserEmail, 0, DateTime.Now);
                int    resultrow = MySqlDbHelper.ExecuteSql(connCommonsStr, insertsql);
                if (resultrow > 0)
                {
                    UsrDto dto = new UsrDto();
                    dto.ID        = id;
                    dto.LoginName = dddd.LoginName;
                    dto.LoginPwd  = md5.ToString();
                    dto.NickName  = dddd.LoginName;
                    dto.UserPhone = dddd.UserPhone;
                    dto.HeadIcon  = "";
                    dto.RoleId    = "2";
                    dto.UserEmail = dddd.UserEmail;
                    dto.status    = 0;
                    dto.CreatedAt = DateTime.Now;
                    dto.Token     = IprAuthorizeAttribute.GetToken(dto.LoginName, 0);
                    return(dto);
                }
                else
                {
                    return(new UsrDto {
                        Error = "注册失败,请重新填写!"
                    });
                }
            }
        }
        public UsrDto Login(string usr_name, string pwd)
        {
            if (string.IsNullOrEmpty(usr_name) || string.IsNullOrEmpty(pwd))
            {
                return new UsrDto {
                           Error = "用户名和密码不能为空"
                }
            }
            ;
            Guid md5 = EncryptHelper.GetEncryPwd(pwd);
            //var _usr = comm.usrs.FirstOrDefault(x => x.UsrName == usr_name && x.PwdMD5 == md5);
            //if (_usr == null)
            //    return new UsrDto { Error = "用户名或密码不对" };
            string selsql = @"select ID,LoginName,LoginPwd,NickName,UserPhone,HeadIcon,RoleId,UserEmail,status,CreatedAt from huangguan_user where LoginName=N'{0}' and LoginPwd='{1}'"
                            .FormatStr(usr_name, md5);
            DataTable dtq = MySqlDbHelper.ExecuteQuery(connCommonsStr, selsql);

            if (dtq.Rows.Count > 0)
            {
                UsrDto dto = new UsrDto();

                dto.ID        = Guid.Parse(dtq.Rows[0]["ID"].ToString());
                dto.LoginName = dtq.Rows[0]["LoginName"].ToString();
                dto.LoginPwd  = dtq.Rows[0]["LoginPwd"].ToString();
                dto.NickName  = dtq.Rows[0]["NickName"].ToString();
                dto.UserPhone = dtq.Rows[0]["UserPhone"].ToString();
                dto.HeadIcon  = dtq.Rows[0]["HeadIcon"].ToString();
                dto.RoleId    = dtq.Rows[0]["RoleId"].ToString();
                dto.UserEmail = dtq.Rows[0]["UserEmail"].ToString();
                dto.status    = Convert.ToInt32(dtq.Rows[0]["status"].ToString());
                dto.CreatedAt = Convert.ToDateTime(dtq.Rows[0]["CreatedAt"].ToString());
                dto.Token     = IprAuthorizeAttribute.GetToken(dto.LoginName, 0);
                return(dto);
            }
            else
            {
                return(new UsrDto {
                    Error = "用户名或密码不对"
                });
            }
        }