Exemplo n.º 1
0
        public void TestRegister()
        {
            Net965808Service ns = new Net965808Service();
            string           msg;
            var res = ns.Regist("xiangpeng", "1234567", out msg, false) ? "注册成功" : "注册失败";

            Console.WriteLine(res);
        }
Exemplo n.º 2
0
        // 注册企业用户接口
        public bool Regist(string username, string pwd, out string msg, bool ignoreExists = false)
        {
            if (!_net965808Service.Regist(username, pwd, out msg))
            {
                return(false);
            }
            string outid;

            if (!_net965808Service.Login(username, pwd, out outid, out msg))
            {
                msg = "965808平台注册失败!";
                return(false);
            }
            var sql = string.Format("select ID from SysUser where UserName='******'", username);
            var dt  = DBHelper.GetDataSet(sql);

            if (dt.Rows.Count > 0)
            {
                if (ignoreExists)
                {
                    sql = string.Format(
                        "update SysUser set UserPassWord='******',OutPlatformId='{1}' where ID={2}",
                        pwd, outid, dt.Rows[0][0]);
                    DBHelper.Execute(sql);
                    return(true);
                }
                msg = "用户名已存在";
                return(false);
            }
            sql = @"
insert into SysUser (RolesID,DepartmentID,UserName,UserPassWord,IsEnable,OutPlatformId)
values(4,5,@un,@pwd,0,@oid)";
            return(DBHelper.Execute(sql,
                                    new SqlParameter("@un", username),
                                    new SqlParameter("@pwd", pwd),
                                    new SqlParameter("@oid", outid)) > 0);
        }