예제 #1
0
        public static BLLErrorCode NewUserRegister(ModelSysUser m)
        {
            if (DALSysUser.IsLoginNameExisted(m))
                return -1; //用户名已经存在

            DALSysUser.SetLoginName(m);
            DALSysUser.SetPassword(m);
            DALSysUser.SetEmail(m);
            return 0;
        }
예제 #2
0
        public static BLLErrorCode UserLogin(ModelSysUser m)
        {
            if (! DALSysUser.IsLoginNameExisted(m))
                return -1; //用户名不存在

            ModelSysUser temp = new ModelSysUser();
            temp.LoginName = m.LoginName;
            DALSysUser.GetPassword(temp);

            if (temp.Password == m.Password)
                return 0;
            else
                return 1;
        }
예제 #3
0
        public static BLLErrorCode SetUserInfo(ModelSysUser m)
        {
            // 检查用户名和密码
            if (UserLogin(m) != 0)
                return -1;

            DALSysUser.SetUserName(m);
            DALSysUser.SetGender(m);
            DALSysUser.SetUserType(m);
            DALSysUser.SetUserStatus(m);
            DALSysUser.SetEmail(m);
            DALSysUser.SetMobile(m);
            DALSysUser.SetAccountStatus(m);
            DALSysUser.SetRole(m);
            DALSysUser.SetRemark(m);
            return 0;
        }
예제 #4
0
 public static bool IsLoginNameExisted(ModelSysUser m)
 {
     DataSet thisSet = DBUtility.DbHelperSQL.Query(DALUtility.SimpleSelect("LoginID", "SysUser", "LoginName='"+m.LoginName+"'"));
     if (thisSet.Tables[0].Rows.Count == 0)
         return false;
     else
         return true;
 }
예제 #5
0
 public static DALErrorCode GetUserType(ModelSysUser m)
 {
     DataSet thisSet = DBUtility.DbHelperSQL.Query(DALUtility.SimpleSelect("UserType", "SysUser", "LoginName='" + m.LoginName + "'"));
     m.UserType = thisSet.Tables[0].Rows[0]["UserType"].ToString();
     return 0;
 }
예제 #6
0
 public static DALErrorCode GetLoginName(ModelSysUser m, string conditions)
 {
     DataSet thisSet = DBUtility.DbHelperSQL.Query(DALUtility.SimpleSelect("LoginName", "SysUser", conditions));
     m.LoginName = thisSet.Tables[0].Rows[0]["LoginName"].ToString();
     return 0;
 }
예제 #7
0
 public static DALErrorCode SetUserType(ModelSysUser m)
 {
     string query = string.Format("update SysUser set UserType = '{0}' where LoginName = '{1}'", m.UserType, m.LoginName);
     DBUtility.DbHelperSQL.Query(query);
     return 0;
 }
예제 #8
0
 public static DALErrorCode GetAccountStatus(ModelSysUser m)
 {
     DataSet thisSet = DBUtility.DbHelperSQL.Query(DALUtility.SimpleSelect("AccountStatus", "SysUser", "LoginName='" + m.LoginName + "'"));
     m.AccountStatus = (bool)thisSet.Tables[0].Rows[0]["AccountStatus"];
     return 0;
 }
예제 #9
0
 public static DALErrorCode SetLoginName(ModelSysUser m)
 {
     if (m.LoginName == null)
         return -1;
     else
     {
         DBUtility.DbHelperSQL.Query(DALUtility.SimpleInsert("SysUser", "LoginName", m.LoginName));
         return 0;
     }
 }
예제 #10
0
        public static void Main(string[] args)
        {
            ModelSysUser mmm = new ModelSysUser();
            //mmm.LoginName = "Lvwei";
            //SetLoginName(mmm);

            mmm.LoginName = "uuu";
            mmm.Password = "******";
            IsLoginNameExisted(mmm);
            SetPassword(mmm);
            Console.ReadKey();
        }