Ejemplo n.º 1
3
 public void PostRegisterInfoAsync(RegisterInfo registerInfo)
 {
     _requestState = new RequestState();
     _registerInfo = registerInfo;
     _httpWebRequest = (HttpWebRequest)WebRequest.Create(_registerURL);
     _timer.Start();
     _requestState.request = _httpWebRequest;
     _httpWebRequest.Method = "POST";
     _httpWebRequest.ContentType = "application/x-www-form-urlencoded";
     _httpWebRequest.BeginGetRequestStream(new AsyncCallback(RequestCallback), _httpWebRequest);
 }
Ejemplo n.º 2
0
 public void UpdateRegisterByRegisterID(RegisterInfo Reginfo)
 {
     try
     {
         using (RMSDataContext db = new RMSDataContext())
         {
             var obj = (from a in db.Registers where a.ID == Reginfo.RegisterID select a).First();
             obj.ID          = Reginfo.RegisterID;
             obj.UserName    = Reginfo.UserName;
             obj.NRC         = Reginfo.NRC;
             obj.DOB         = Reginfo.DOB;
             obj.Picture     = Reginfo.Picture;
             obj.Address     = Reginfo.Address;
             obj.Gender      = Reginfo.Gender;
             obj.Phone       = Reginfo.Phone;
             obj.Password    = Reginfo.Password;
             obj.Email       = Reginfo.Email;
             obj.UpdatedDate = Reginfo.UpdateDate;
             db.SubmitChanges();
         }
     }
     catch (Exception ex)
     {
         Register Reg = new Register();
     }
 }
Ejemplo n.º 3
0
        public static RegisterInfo GetRegisterInfo(string amiiboId, string nickname)
        {
            VirtualAmiiboFile amiiboFile = LoadAmiiboFile(amiiboId);

            UtilityImpl utilityImpl = new UtilityImpl();
            CharInfo    charInfo    = new CharInfo();

            charInfo.SetFromStoreData(StoreData.BuildDefault(utilityImpl, 0));

            charInfo.Nickname = Nickname.FromString(nickname);

            RegisterInfo registerInfo = new RegisterInfo()
            {
                MiiCharInfo     = charInfo,
                FirstWriteYear  = (ushort)amiiboFile.FirstWriteDate.Year,
                FirstWriteMonth = (byte)amiiboFile.FirstWriteDate.Month,
                FirstWriteDay   = (byte)amiiboFile.FirstWriteDate.Day,
                FontRegion      = 0,
                Reserved1       = new Array64 <byte>(),
                Reserved2       = new Array58 <byte>()
            };

            Encoding.ASCII.GetBytes("Ryujinx").CopyTo(registerInfo.Nickname.ToSpan());

            return(registerInfo);
        }
        public HttpResponseMessage Register([FromBody] RegisterInfo client)
        {
            User user = db.User.Where(usr => usr.Nickname == client.Nickname && usr.PasswordHash == client.PasswordHash && usr.Email == client.Email).FirstOrDefault();

            if (user != null)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Such user allready exists"));
            }

            Guid refreshToken = Guid.NewGuid();
            User registerUser = new User()
            {
                Email = client.Email, Nickname = client.Nickname, PasswordHash = client.PasswordHash, RefreshToken = refreshToken, RefreshTokenExpirationDate = DateTime.UtcNow.AddDays(1)
            };

            db.User.Add(registerUser);
            db.SaveChanges();

            User allreadyRegisteredUser = db.User.Where(usr => usr.Nickname == client.Nickname && usr.PasswordHash == client.PasswordHash && usr.Email == client.Email).FirstOrDefault();

            if (allreadyRegisteredUser == null)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Error during registration"));
            }

            AuthInfo authenticationInfo = new AuthInfo()
            {
                UserId = allreadyRegisteredUser.Id, NickName = allreadyRegisteredUser.Nickname, JWT_Token = JWT_Manager.GenerateToken(allreadyRegisteredUser.Id, allreadyRegisteredUser.Nickname, 5), RefreshToken = refreshToken.ToString()
            };

            return(Request.CreateResponse(HttpStatusCode.OK, authenticationInfo));
        }
Ejemplo n.º 5
0
        public async Task <ActionResult> RegisterAsync([FromBody] RegisterInfo registerInfo)
        {
            // TODO: implement AutoMapper registerInfo -> User
            var user = new User
            {
                Name      = registerInfo.Name,
                Email     = registerInfo.Email,
                UserType  = UserType.Staff,
                CreatedAt = DateTime.Now,
            };

            try
            {
                var bio = registerInfo.BirthDateGenderString;

                if (int.TryParse(bio.Substring(6, 1), out int sex) &&
                    int.TryParse(bio.Substring(0, 2), out int year) &&
                    int.TryParse(bio.Substring(2, 2), out int month) &&
                    int.TryParse(bio.Substring(4, 2), out int day))
                {
                    year          += sex > 2 ? 2000 : 1900;
                    user.BirthDate = new DateTime(year, month, day);
                    user.Gender    = sex % 2 == 0 ? GenderType.Female : GenderType.Male;
                }
                await _userService.CreateAsync(user, registerInfo.Password);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(new { message = ex.Message }));
            }
        }
Ejemplo n.º 6
0
        public void SaveRegUserDetails(RegisterInfo objreginfo)
        {
            //SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["ds"].ToString());
               //SqlCommand cmd = new SqlCommand("USP_MultiSaveRegUser", con);
               //con.Open();
               //cmd.Parameters.Add(new SqlParameter("@UserName", UserName));
               //cmd.Parameters.Add(new SqlParameter("@Pwd", Pwd));
               //cmd.Parameters.Add(new SqlParameter("@FirstName", FName));
               //cmd.Parameters.Add(new SqlParameter("@LastName", Lname));
               //cmd.Parameters.Add(new SqlParameter("@TypeOfUser", TypUser));

               //cmd.CommandType = CommandType.StoredProcedure;
               //cmd.ExecuteNonQuery();
               //con.Close();

               string spNameString = string.Empty;
               // DataSet dsLogInfo = new DataSet();
               Database dbDatabase = DatabaseFactory.CreateDatabase(Global.INSTANCE_NAME);
               spNameString = "USP_MultiSaveRegUser";
               DbCommand dbCommand = null;

               dbCommand = dbDatabase.GetStoredProcCommand(spNameString);

               dbDatabase.AddInParameter(dbCommand, "@UserName", System.Data.DbType.String, objreginfo.Uname);
               dbDatabase.AddInParameter(dbCommand, "@Pwd", System.Data.DbType.String, objreginfo.passwrd);
               dbDatabase.AddInParameter(dbCommand, "@FirstName", System.Data.DbType.String, objreginfo.FName);
               dbDatabase.AddInParameter(dbCommand, "@LastName", System.Data.DbType.String, objreginfo.LName);
               dbDatabase.AddInParameter(dbCommand, "@TypeOfUser", System.Data.DbType.String, objreginfo.Typuser);
               dbDatabase.ExecuteDataSet(dbCommand);
        }
Ejemplo n.º 7
0
        public async Task CreateRegisterInfo(RegisterInfo newRegInfo, string Password)
        {
            var isExistPremises = await _premisesRepos.FindByName(newRegInfo.PremisesName);

            var isExistUser = await _userRepository.FindByUsername(newRegInfo.Username);

            if (isExistPremises != null)
            {
                throw new DuplicatedPremisesNameException("Tên cơ sở đã tồn tại");
            }
            else if (isExistUser != null)
            {
                throw new DuplicatedUsernameException("Tài khoản đã tồn tại");
            }

            else
            {
                //tạo premises mới
                var newPremises = new Premises();
                newPremises.Name         = newRegInfo.PremisesName;
                newPremises.Address      = newRegInfo.PremisesAddress;
                newPremises.PremisesType = _premisesTypeRepos.GetById(newRegInfo.PremisesTypeId);
                //tạo user mới
                var user           = new User();
                var hashedPassword = PasswordHasher.GetHashPassword(Password); //Get hashedpassword
                var role           = _roleRepos.GetById(2);                    //Get manager Role
                user.Password = hashedPassword.HashedPassword;
                user.Fullname = newRegInfo.Fullname;
                user.Salt     = hashedPassword.Salt;
                user.Role     = role;
                user.Username = newRegInfo.Username;
                user.Email    = newRegInfo.Email;
                user.Image    = "/app-assets/images/avatar.jpg";
                user.Premises = newPremises;
                //Code for activation

                string activateCode = Util.GeneratePassword(new Models.PasswordOptions()
                {
                    RequireDigit           = true,
                    RequiredLength         = 12,
                    RequireLowercase       = true,
                    RequireNonAlphanumeric = false,
                    RequireUppercase       = true
                });

                user.ActivationCode = activateCode;
                user.IsConfirmEmail = false;
                _userRepository.Insert(user, true);
                //tạo register info

                /*newRegInfo.RegisterId = 0;
                 * newRegInfo.IsConfirm = null;
                 * _registerRepos.Insert(newRegInfo, true);*/


                //Send email
                await _mailSender.SendEmailAsync(user.Email, "[TFS] Kích Hoạt tài khoản", "Vui lòng nhấn vào để kích hoạt tài khoản \n"
                                                 + " https://localhost:5000/kich-hoat-tai-khoan/?ActivationCode=" + activateCode);
            }
        }
Ejemplo n.º 8
0
        public void Make(string username, string password, string type)
        {
            //查询结果容器
            DataSet record = new DataSet();
            //从索引中补全语句
            MySqlDBCore.Execute(SQL_CHECK_REGISTER + "'" + username + "'", ref record);

            if (record.Tables.Count != 0)
            {
                if (record.Tables[0].Rows.Count != 0)
                {
                    this.registerInfo = new RegisterInfo("user already exist");
                    return;
                }
                else
                {
                    MySqlDBCore.Execute(SQL_ADD_USER + "(" + "'" + username + "'" + "," + "'" + password + "'" + "," + "'" + type + "'" + ")");
                    if(type.Equals("1"))
                        MySqlDBCore.Execute(SQL_ADD_NULL_COMPANY_ST + username + SQL_ADD_NULL_COMPANY_ED);
                    else
                        MySqlDBCore.Execute("");
                    //this.registerInfo = new RegisterInfo(SQL_ADD_USER + "(" + "'" + username + "'" + "," + "'" + password + "'" + "," + "'" + type + "'" + ")");
                    this.registerInfo = new RegisterInfo("succeed");
                    return;
                }
            }
            this.registerInfo = new RegisterInfo("error");
        }
Ejemplo n.º 9
0
        public List <RegisterInfo> SelectallRegisterinfo()
        {
            try
            {
                List <RegisterInfo> lstinfo = new List <RegisterInfo>();
                using (RMSDataContext db = new RMSDataContext())
                {
                    RegisterInfo rinfo;
                    var          a = (from o in db.Registers select o).ToList();
                    foreach (var obj in a)
                    {
                        rinfo            = new RegisterInfo();
                        rinfo.RegisterID = obj.ID;
                        rinfo.UserName   = obj.UserName;
                        rinfo.NRC        = obj.NRC;
                        rinfo.DOB        = obj.DOB;
                        rinfo.Picture    = (obj.Picture.ToArray());

                        rinfo.Address    = obj.Address;
                        rinfo.Gender     = obj.Gender;
                        rinfo.Phone      = obj.Phone;
                        rinfo.Password   = obj.Password;
                        rinfo.Email      = obj.Email;
                        rinfo.InsertDate = obj.InsertedDate;
                        //rinfo.UpdateDate = obj.UpdatedDate;
                        lstinfo.Add(rinfo);
                    }
                    return(lstinfo);
                }
            }
            catch (Exception ex)
            {
                return(new List <RegisterInfo>());
            }
        }
Ejemplo n.º 10
0
        public static RegisterInfo GetRegisterInfo(string amiiboId)
        {
            VirtualAmiiboFile amiiboFile = LoadAmiiboFile(amiiboId);

            UtilityImpl utilityImpl = new UtilityImpl();
            CharInfo    charInfo    = new CharInfo();

            charInfo.SetFromStoreData(StoreData.BuildDefault(utilityImpl, 0));

            // TODO: Maybe change the "no name" by the player name when user profile will be implemented.
            // charInfo.Nickname = Nickname.FromString("Nickname");

            RegisterInfo registerInfo = new RegisterInfo()
            {
                MiiCharInfo     = charInfo,
                FirstWriteYear  = (ushort)amiiboFile.FirstWriteDate.Year,
                FirstWriteMonth = (byte)amiiboFile.FirstWriteDate.Month,
                FirstWriteDay   = (byte)amiiboFile.FirstWriteDate.Day,
                FontRegion      = 0,
                Reserved1       = new Array64 <byte>(),
                Reserved2       = new Array58 <byte>()
            };

            Encoding.ASCII.GetBytes("Ryujinx").CopyTo(registerInfo.Nickname.ToSpan());

            return(registerInfo);
        }
Ejemplo n.º 11
0
        public ActionResult Register(RegisterInfo data)
        {
            var isapi = new isapiSOAP.ICUTechClient();

            ViewBag.Response = isapi.RegisterNewCustomer(data.email, data.password, data.firstName, data.lastName, data.mobile, data.countryID, data.aID, data.signupIP);
            return(View());
        }
Ejemplo n.º 12
0
        public static Result AppRegister(RegisterInfo info)
        {
            Result result = new Result();

            AxCRL.Services.SystemService SysSvc = new SystemService();
            Result CodeResult = VerifyCode(info.inputId, info.VerificationCode);

            if (CodeResult.ReturnValue)
            {
                if (string.IsNullOrEmpty(SysSvc.Register(info)))
                {
                    DeleteCode(info.inputId);
                    result.ReturnValue = true;
                }
                else
                {
                    result.Message     = SysSvc.Register(info);
                    result.ReturnValue = false;
                }
            }
            else
            {
                result.Message     = CodeResult.Message;
                result.ReturnValue = false;
            }
            return(result);
        }
Ejemplo n.º 13
0
        public async Task <ServiceResult> Register(RegisterInfo request)
        {
            var result = new ServiceResult();

            if (request.Password != request.PasswordRepeat)
            {
                result.Errors.Add("Passwords do not match");
            }

            var passwordValidated = await PasswordValidator.ValidateAsync(request.Password);

            if (!passwordValidated.Succeeded)
            {
                result.Errors.Add("Password validation failed");
            }

            if (_repository.GetAll <User>().Any(u => u.UserName == request.Email))
            {
                result.Errors.Add("User with that email already exists");
            }

            var user = new User
            {
                UserName = request.Email
            };

            var userValidationResult = await UserValidator.ValidateAsync(user);

            if (userValidationResult.Succeeded)
            {
                await CreateAsync(user, request.Password);
            }

            return(result);
        }
Ejemplo n.º 14
0
        public IActionResult Register(RegisterInfo register, string returnUrl)
        {
            ViewData["ReturnUrl"] = returnUrl;
            string message = string.Empty;

            if (ModelState.IsValid)
            {
                if (_user.RegisterUser(register) > 0)
                {
                    //Register Service
                    TempData["message"] = "You successed the register";
                    return(RedirectToAction("Login", "Membership"));
                }
                else
                {
                    message = "You are not registered in the system";
                }
            }
            else
            {
                message = "You must input all of details correctly";
            }
            ModelState.AddModelError(string.Empty, message);
            return(View(register));
        }
Ejemplo n.º 15
0
		public override RegisterResponseInfo Register (RegisterInfo registerInfo)
		{
			Node n = new Node ();
			RegisterResponseInfo rri;
			
			if (ControlShape)
			{
				lock (mesh_lock)
				{
					Guid guid = Guid.NewGuid ();
					n.RegistrationId = guid;
					n.Address = registerInfo.NodeAddress;
					n.ClientId = registerInfo.ClientId;
					Console.WriteLine ("Register: {0}", n.ClientId);
					
					if (nodes_count == 0)
						unique_node = n;
					
					nodes_count ++;
					rri = new RegisterResponseInfo (n.RegistrationId, TimeSpan.MaxValue);
				}
			}
			else
				rri = base.Register (registerInfo);
			
			return rri;
		}
Ejemplo n.º 16
0
        //Register a New User
        public static void RegisterNow(RegisterInfo registerInfo)
        {
            using (MySqlConnection connection = DbInfo.Connection())
            {
                using (MySqlCommand cmd = new MySqlCommand())
                {
                    cmd.Connection  = connection;
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText =
                        "INSERT INTO `users`(`ID`, `Firstname`, `Middlename`, `Lastname`, `Email`, `Password`, `Pin`) " +
                        "VALUES (@ID,@Firstname,@Middlename,@Lastname,@Email,@Password,@Pin)";

                    cmd.Parameters.AddWithValue("@ID", "");
                    cmd.Parameters.AddWithValue("@Firstname", registerInfo.firstname);
                    cmd.Parameters.AddWithValue("@Middlename", registerInfo.middlename);
                    cmd.Parameters.AddWithValue("@Lastname", registerInfo.lastname);
                    cmd.Parameters.AddWithValue("@Email", registerInfo.email);
                    cmd.Parameters.AddWithValue("@Password", registerInfo.Password);
                    cmd.Parameters.AddWithValue("@Pin", int.Parse("0"));

                    try
                    {
                        //connection.Open();
                        int recordsAffected = cmd.ExecuteNonQuery();
                        //MessageBox.Show("person has added");
                    }
                    finally
                    {
                        connection.Close();
                    }
                }
            }
        }
Ejemplo n.º 17
0
        // GetRegisterInfo(bytes<8, 4>) -> buffer<unknown<0x100>, 0x1a>
        public ResultCode GetRegisterInfo(ServiceCtx context)
        {
            ResultCode resultCode = CheckNfcIsEnabled();

            if (resultCode != ResultCode.Success)
            {
                return(resultCode);
            }

            if (context.Request.RecvListBuff.Count == 0)
            {
                return(ResultCode.WrongArgument);
            }

            ulong outputPosition = context.Request.RecvListBuff[0].Position;

            context.Response.PtrBuff[0] = context.Response.PtrBuff[0].WithSize((uint)Marshal.SizeOf(typeof(RegisterInfo)));

            MemoryHelper.FillWithZeros(context.Memory, outputPosition, Marshal.SizeOf(typeof(RegisterInfo)));

            uint deviceHandle = (uint)context.RequestData.ReadUInt64();

            if (context.Device.System.NfpDevices.Count == 0)
            {
                return(ResultCode.DeviceNotFound);
            }

            for (int i = 0; i < context.Device.System.NfpDevices.Count; i++)
            {
                if (context.Device.System.NfpDevices[i].Handle == (PlayerIndex)deviceHandle)
                {
                    if (context.Device.System.NfpDevices[i].State == NfpDeviceState.TagRemoved)
                    {
                        resultCode = ResultCode.TagNotFound;
                    }
                    else
                    {
                        if (context.Device.System.NfpDevices[i].State == NfpDeviceState.TagMounted)
                        {
                            RegisterInfo registerInfo = VirtualAmiibo.GetRegisterInfo(
                                context.Device.System.TickSource,
                                context.Device.System.NfpDevices[i].AmiiboId,
                                context.Device.System.AccountManager.LastOpenedUser.Name);

                            context.Memory.Write(outputPosition, registerInfo);

                            resultCode = ResultCode.Success;
                        }
                        else
                        {
                            resultCode = ResultCode.WrongDeviceState;
                        }
                    }

                    break;
                }
            }

            return(resultCode);
        }
Ejemplo n.º 18
0
        public ActionResult RegisterDetail()
        {
            var    _RegisterInfo = new RegisterInfo();
            string _casecode     = "";

            if (RouteData.Values["id"] != null)
            {
                _casecode = RouteData.Values["id"].ToString();
            }
            try
            {
                var userBL = new UserBL();
                _RegisterInfo = userBL.RegisterGetByCaseCode(_casecode);
                //  lấy dữ liệu lịch sử giao dịch
                B_Todos_BL           _B_Todos_BL = new B_Todos_BL();
                List <B_Remind_Info> _ListRemind = new List <B_Remind_Info>();
                List <B_Todos_Info>  _Listtodo   = _B_Todos_BL.NotifiGetByCasecode(_casecode, ref _ListRemind);
                ViewBag.ListTodo   = _Listtodo;
                ViewBag.ListRemind = _ListRemind;
                return(PartialView("~/Areas/ModuleUsersAndRoles/Views/User/ViewRegisterInfo.cshtml", _RegisterInfo));
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }
            return(null);
        }
Ejemplo n.º 19
0
        private static RegisterInfo GetRegisterInfo(Window appbarWindow)
        {
            RegisterInfo reg;

            if (RegisteredWindowInfo.ContainsKey(appbarWindow))
            {
                reg = RegisteredWindowInfo[appbarWindow];
            }
            else
            {
                reg = new RegisterInfo()
                {
                    CallbackId       = 0,
                    Window           = appbarWindow,
                    IsRegistered     = false,
                    Edge             = ABEdge.Top,
                    OriginalStyle    = appbarWindow.WindowStyle,
                    OriginalPosition = new Point(appbarWindow.Left, appbarWindow.Top),
                    OriginalSize     =
                        new Size(appbarWindow.ActualWidth, appbarWindow.ActualHeight),
                    OriginalResizeMode = appbarWindow.ResizeMode,
                    OriginalTopmost    = appbarWindow.Topmost,
                    DockedSize         = null
                };
                RegisteredWindowInfo.Add(appbarWindow, reg);
            }
            return(reg);
        }
Ejemplo n.º 20
0
        public static bool VerifyLogin()
        {
            RegisterInfo registerInfo = registerDao.FindByName(DEFAULT_NAME);

            if (registerInfo == null)
            {
                registerInfo = new RegisterInfo(DEFAULT_NAME, getMd5Hash(DEFAULT_NAME));
                registerDao.Insert(registerInfo);
            }

            bool re = true;

            if (string.IsNullOrEmpty(MY_KEY) || !MY_KEY.Equals(registerInfo.Md5Key))
            {
                if (registerInfo.LoginTime >= LOGIN_TIME_LIMIT)
                {
                    re = false;
                }
                else
                {
                    registerInfo.LoginTime++;
                    registerDao.UpdateNoneIndex(registerInfo);
                }
            }

            return(re);
        }
 public ApolloHelper()
 {
     this.info = new ApolloInfo(ApolloConfig.QQAppID, ApolloConfig.WXAppID, ApolloConfig.maxMessageBufferSize, string.Empty);
     IApollo.Instance.Initialize(this.info);
     IApollo.Instance.SetApolloLogger(ApolloLogPriority.None, null);
     this.accountService                  = IApollo.Instance.GetAccountService();
     this.payService                      = null;
     this.registerInfo                    = new RegisterInfo();
     this.snsService                      = (IApollo.Instance.GetService(1) as IApolloSnsService);
     this.reportService                   = (IApollo.Instance.GetService(3) as IApolloReportService);
     this.quickLoginService               = (IApollo.Instance.GetService(7) as IApolloQuickLoginService);
     this.m_IsSwitchToLoginPlatform       = false;
     this.m_IsLoginEventHandlerRegistered = false;
     this.m_IsLoginReturn                 = false;
     this.CurPlatform                     = ApolloPlatform.None;
     this.m_LastOpenID                    = null;
     this.m_LastTriedPlatform             = ApolloPlatform.None;
     this.m_IsLastTriedPlatformSet        = false;
     this.IsLastLaunchFrom3rdAPP          = false;
     if (File.Exists(Application.persistentDataPath + "/customOpenId.txt"))
     {
         this.IsNoneModeSupport = true;
     }
     else
     {
         this.IsNoneModeSupport = false;
     }
     HttpDnsPolicy.Init();
 }
Ejemplo n.º 22
0
        public static bool VerifySearch()
        {
            RegisterInfo registerInfo = registerDao.FindByName(DEFAULT_NAME);

            if (registerInfo == null)
            {
                return(false);
            }

            bool re = true;

            if (string.IsNullOrEmpty(MY_KEY) || !MY_KEY.Equals(registerInfo.Md5Key))
            {
                if (registerInfo.SearchTime >= SEARCH_TIME_LIMIT)
                {
                    re = false;
                }
                else
                {
                    registerInfo.SearchTime++;
                    registerDao.UpdateNoneIndex(registerInfo);
                }
            }

            return(re);
        }
Ejemplo n.º 23
0
        public static ServerResponse Register(string account, string password, string confirmPassword, string email = null, string mobile = null, Sex?sex = null, DateTime?birthday = null, string fullName = null, string nickName = null)
        {
            ServerResponse response = new ServerResponse();
            RegisterInfo   info     = new RegisterInfo()
            {
                ClientId        = CurrentClient.ClientId,
                SessionId       = HttpContext.Current.Session.SessionID,
                DeviceId        = HttpContext.Current.Request.UserHostAddress,
                DeviceInfo      = HttpContext.Current.Request.UserAgent,
                Account         = account,
                Password        = password,
                ConfirmPassword = confirmPassword,
                Email           = email,
                Mobile          = mobile,
                Sex             = sex,
                Birthday        = birthday,
                FullName        = fullName,
                NickName        = nickName
            };

            try
            {
                var cp = IocInstance.Container.Resolve <ISSOClientProvider>();
                var r  = cp.Register(info);
                response.Status  = r.Status;
                response.Message = r.Message;
            }
            catch (Exception ex)
            {
                response.Status  = ResponseStatus.Exception;
                response.Message = ex.Message;
            }

            return(response);
        }
Ejemplo n.º 24
0
 public ApolloHelper()
 {
     IApollo.Instance.Initialize(this.info);
     IApollo.Instance.SetApolloLogger(ApolloLogPriority.None, null);
     this.accountService                  = IApollo.Instance.GetAccountService();
     this.payService                      = null;
     this.registerInfo                    = new RegisterInfo();
     this.snsService                      = IApollo.Instance.GetService(1) as IApolloSnsService;
     this.reportService                   = IApollo.Instance.GetService(3) as IApolloReportService;
     this.quickLoginService               = IApollo.Instance.GetService(7) as IApolloQuickLoginService;
     this.m_IsSwitchToLoginPlatform       = false;
     this.m_IsLoginEventHandlerRegistered = false;
     this.m_IsLoginReturn                 = false;
     this.CurPlatform                     = ApolloPlatform.None;
     this.m_LastOpenID                    = null;
     this.m_LastTriedPlatform             = ApolloPlatform.None;
     this.m_IsLastTriedPlatformSet        = false;
     if (File.Exists(Application.persistentDataPath + "/customOpenId.txt"))
     {
         this.IsNoneModeSupport = true;
     }
     else
     {
         this.IsNoneModeSupport = false;
     }
 }
Ejemplo n.º 25
0
 public static int RegisterUpdate(RegisterInfo pRegistor)
 {
     try
     {
         var paramReturn = new OracleParameter("P_RETURN", OracleDbType.Int32, ParameterDirection.Output);
         OracleHelper.ExecuteNonQuery(Configuration.connectionString, CommandType.StoredProcedure, "PKG_REGISTOR.PROC_REGISTOR_UPDATE",
                                      new OracleParameter("P_ID", OracleDbType.Decimal, pRegistor.Id, ParameterDirection.Input),
                                      new OracleParameter("P_FISTNAME", OracleDbType.Varchar2, pRegistor.FistName, ParameterDirection.Input),
                                      new OracleParameter("P_LASTNAME", OracleDbType.Varchar2, pRegistor.LastName, ParameterDirection.Input),
                                      new OracleParameter("P_PHONE", OracleDbType.Varchar2, pRegistor.Phone, ParameterDirection.Input),
                                      new OracleParameter("P_EMAIL", OracleDbType.Varchar2, pRegistor.Email, ParameterDirection.Input),
                                      new OracleParameter("P_COMPANY", OracleDbType.Varchar2, pRegistor.Company, ParameterDirection.Input),
                                      new OracleParameter("P_MODIFIEDBY", OracleDbType.Varchar2, pRegistor.Modifiedby, ParameterDirection.Input),
                                      new OracleParameter("P_STATUS", OracleDbType.Int32, pRegistor.Status, ParameterDirection.Input),
                                      new OracleParameter("P_KEYSECRET", OracleDbType.Varchar2, pRegistor.KeySecret, ParameterDirection.Input),
                                      paramReturn);
         var result = Convert.ToInt32(paramReturn.Value.ToString());
         return(result);
     }
     catch (Exception ex)
     {
         Logger.LogException(ex);
         return(-1);
     }
 }
Ejemplo n.º 26
0
        // 아이디에 대해서 대소문자 처리
        private int RegisterUser(RegisterInfo register)
        {
            var utcNow       = DateTime.UtcNow;
            var passwordInfo = _hasher.SetPasswordInfo(register.UserId, register.Password);

            var user = new User()
            {
                UserId                = register.UserId.ToLower(),
                UserName              = register.UserName,
                UserEmail             = register.UserEmail,
                GUIDSalt              = passwordInfo.GUIDSalt,
                RNGSalt               = passwordInfo.RNGSalt,
                PasswordHash          = passwordInfo.PasswordHash,
                AccessFailedCount     = 0,
                IsMembershipWithdrawn = false,
                JoinedUtcDate         = utcNow
            };

            var userRolesByUser = new UserRolesByUser()
            {
                UserId       = register.UserId.ToLower(),
                RoleId       = "AssociateUser",
                OwnedUtcDate = utcNow
            };

            _context.Add(user);
            _context.Add(userRolesByUser);

            return(_context.SaveChanges());
        }
Ejemplo n.º 27
0
        //public async Task<IActionResult> Register(string firstName, string lastName, string username, string password, string email)
        public async Task <IActionResult> Register(RegisterInfo registerInfo)
        {
            IdentityResult result;

            try
            {
                AppUser user = await UserMgr.FindByNameAsync(registerInfo.UserName);

                if (user == null)
                {
                    user = new AppUser
                    {
                        UserName  = registerInfo.UserName,
                        Email     = registerInfo.Email,
                        FirstName = registerInfo.FirstName,
                        LastName  = registerInfo.LastName
                    };

                    result = await UserMgr.CreateAsync(user, registerInfo.Password);
                }
            }
            catch (Exception ex)
            {
                ViewBag.Message = ex.Message;
            }

            return(RedirectToAction("Login", "Account"));
        }
Ejemplo n.º 28
0
        public void InsertRegister(RegisterInfo reginfo)
        {
            try
            {
                using (RMSDataContext db = new RMSDataContext())
                {
                    Register reg = new Register();
                    Guid     id;
                    id           = Guid.NewGuid();
                    reg.ID       = id.ToString();
                    reg.UserName = reginfo.UserName;
                    reg.NRC      = reginfo.NRC;
                    reg.DOB      = reginfo.DOB;
                    System.Data.Linq.Binary file_binary = new System.Data.Linq.Binary(reginfo.Picture);
                    reg.Picture      = file_binary;
                    reg.Address      = reginfo.Address;
                    reg.Gender       = reginfo.Gender;
                    reg.Phone        = reginfo.Phone;
                    reg.Password     = reginfo.Password;
                    reg.Email        = reginfo.Email;
                    reg.InsertedDate = DateTime.UtcNow.AddMinutes(390);
                    reg.UpdatedDate  = DateTime.UtcNow.AddMinutes(390);

                    db.Registers.InsertOnSubmit(reg);
                    db.SubmitChanges();
                }
            }
            catch
            {
                Register a = new Register();
            }
        }
Ejemplo n.º 29
0
        private string GetOrgCodeForOrg(int orgId, RegisterInfo delregInfo)
        {
            var orgCodeList       = new List <string>();
            var org               = _portalService.HamtaOrganisation(orgId);
            var orgtypeListForOrg = _portalService.HamtaOrgtyperForOrganisation(orgId);
            var orgCode           = String.Empty;

            //Compare organisations orgtypes with orgtypes for current subdir
            foreach (var subDirOrgtype in delregInfo.Organisationstyper)
            {
                foreach (var orgOrgtype in orgtypeListForOrg)
                {
                    if (subDirOrgtype.Value == orgOrgtype.Typnamn)
                    {
                        if (orgOrgtype.Typnamn == "Kommun")
                        {
                            orgCode = org.Kommunkod;
                        }
                        else if (orgOrgtype.Typnamn == "Landsting")
                        {
                            orgCode = org.Landstingskod;
                        }
                        else
                        {
                            orgCode = org.Inrapporteringskod;
                        }
                    }
                }
            }
            return(orgCode);
        }
Ejemplo n.º 30
0
        public IActionResult Register(RegisterInfo register, string returnUrl)
        {
            ViewData["ReturnUrl"] = returnUrl;

            string message = string.Empty;

            if (ModelState.IsValid)
            {
                //사용자 가입 서비스
                if (_user.RegisterUser(register) > 0)
                {
                    TempData["Message"] = "사용자 가입이 성공적으로 이루어졌습니다.";
                    return(RedirectToAction("Login", "Membership"));
                }
                else
                {
                    message = "사용자가 가입되지 않았습니다.";
                }
            }
            else
            {
                message = "사용자 가입을 위한 정보를 올바르게 입력하세요.";
            }

            ModelState.AddModelError(string.Empty, message);
            return(View(register));
        }
Ejemplo n.º 31
0
        /// <summary>
        /// 创建案例
        /// </summary>
        /// <returns></returns>
        public ActionResult CreateCase(string id = "")
        {
            RegisterInfo model = IRegisterInfo.GetRegisterInfoById(id);

            if (model == null)
            {
                SRTypelist();
                return(View());
            }
            else
            {
                RegisterViewModel viewModel = new RegisterViewModel()
                {
                    BeSeekerName    = model.BeSeekerName,
                    CaseCode        = model.CaseCode,
                    GetTaskDateTime = model.GetTaskDateTime,
                    //getTaskDate=model.GetTaskDateTime.ToShortDateString(),
                    PostLink       = model.PostLink,
                    RegisterInfoId = model.RegisterInfoID,
                    RegisterLink   = model.RegisterLink,
                    Remarks        = model.Remarks,
                    SRTypeId       = model.SRTypeID,
                    Title          = model.Title
                };
                SRTypelist();
                return(View(viewModel));
            }
        }
Ejemplo n.º 32
0
        public async Task <ActionResult <string> > Register([FromBody] RegisterInfo info)
        {
            Response.ContentType = "application/json";

            if (ModelState.IsValid)
            {
                IdentityUser user = new IdentityUser {
                    Email = info.email, UserName = info.userName
                };

                var result = await _userManager.CreateAsync(user, info.password);

                if (result.Succeeded)
                {
                    await _signInManager.SignInAsync(user, false);

                    HttpContext.User = await _signInManager.CreateUserPrincipalAsync(user);
                }
                else
                {
                    string errors = "";
                    foreach (var error in result.Errors)
                    {
                        errors += error.Description;
                    }
                    return(Ok(errors));
                }
            }

            return(Ok("Registered"));
        }
Ejemplo n.º 33
0
        public override RegisterResponseInfo Register(RegisterInfo registerInfo)
        {
            Node n = new Node();
            RegisterResponseInfo rri;

            if (ControlShape)
            {
                lock (mesh_lock)
                {
                    Guid guid = Guid.NewGuid();
                    n.RegistrationId = guid;
                    n.Address        = registerInfo.NodeAddress;
                    n.ClientId       = registerInfo.ClientId;
                    Console.WriteLine("Register: {0}", n.ClientId);

                    if (nodes_count == 0)
                    {
                        unique_node = n;
                    }

                    nodes_count++;
                    rri = new RegisterResponseInfo(n.RegistrationId, TimeSpan.MaxValue);
                }
            }
            else
            {
                rri = base.Register(registerInfo);
            }

            return(rri);
        }
Ejemplo n.º 34
0
        public ActionResult Register(RegisterInfo model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            RegisterInfo registerUser = new AccountManager().AccountRegister(model);

            if (registerUser.ValidateResult.ValidateResultType == RegisterValidateResultType.UserIsExist)
            {
                ModelState.AddModelError("UserName", "Username is existed.");
                return(View(model));
            }
            else if (registerUser.ValidateResult.ValidateResultType == RegisterValidateResultType.InvalidPassword)
            {
                ModelState.AddModelError("Password", "Please input the same password confirmed.");
                return(View(model));
            }
            else
            {
                Log.Write(LogEventLevel.Information, "Reigster success. And the register username is {0}", registerUser.UserName);
                return(RedirectToAction("Login", "Account"));
            }
        }
Ejemplo n.º 35
0
        public IServerResponse Register(RegisterInfo registerInfo)
        {
            Assert.IsNotNull(registerInfo);
            Assert.IsStringNotNullOrEmpty(registerInfo.Password);

            IServerResponse<Session> response = serverProvider.Register(registerInfo);
            if (response.Status == ResponseStatus.Success && response.Data != null)
            {
                SaveSession(response.Data);
            }

            return response;
        }
Ejemplo n.º 36
0
        public IServerResponse Register(RegisterInfo registerInfo)
        {
            Assert.IsNotNull(registerInfo);
            Assert.IsStringNotNullOrEmpty(registerInfo.Password);

            IServerResponse<Session> response = null;

            var chanel = CreateChannel();
            chanel.Call(p =>
            {
                response = p.Register(registerInfo);
                if (response.Status == ResponseStatus.Success && response.Data != null)
                {
                    SaveSession(response.Data);
                }
            });

            return response;
        }
Ejemplo n.º 37
0
        public ActionResult Register(RegisterInfo registerInfo)
        {
            if (ModelState.IsValid)
            {
                var emails = repository.Users.Select(x => x.Email);
                if (emails.Any(x => x.Equals(registerInfo.Email)))
                {
                    ModelState["Email"].Errors.Add("Указанная почта уже занята");
                }
                else
                {
                    var user = (User)ModelMapper.Map(registerInfo, typeof(RegisterInfo), typeof(User));
                    repository.SaveUser(user);
                    return RedirectToAction("Index", "Home");
                }
            }

            return View(registerInfo);
        }
Ejemplo n.º 38
0
		public static void Main ()
		{
			BasicHttpBinding binding = new BasicHttpBinding ();
			EndpointAddress ea = new EndpointAddress (
				new Uri ("http://localhost:8080/ChatServer"));
			IPeerResolverContract proxy = ChannelFactory<IPeerResolverContract>.CreateChannel (binding, ea);
//			try {
				Guid guid = Guid.NewGuid ();
				Console.WriteLine (guid);
				RegisterInfo ri = new RegisterInfo (
					guid, "net.p2p://chatMesh/ChatServer", 
					new PeerNodeAddress (new EndpointAddress ("http://localhost:8080/ChatServer"), 
					                     new ReadOnlyCollection<System.Net.IPAddress> (new List<System.Net.IPAddress> ())));
				RegisterResponseInfo rri = proxy.Register (ri);
				Console.WriteLine ("Response: {0}", rri);
//			}
//			catch (Exception e) {
//				Console.WriteLine (e.Message);
//			}
		}
Ejemplo n.º 39
0
        /// <summary>
        /// The create user.
        /// </summary>
        /// <param name="registerInfo">
        /// The register info.
        /// </param>
        /// <returns>
        /// The <see cref="User"/>.
        /// </returns>
        /// <exception cref="Exception">
        /// </exception>
        public User CreateUser(RegisterInfo registerInfo)
        {
            User newUser = new User();

            if (!this.IsAlreadyUserExist(registerInfo.Login))
            {
                if (this.Validate(registerInfo))
                {
                    newUser.Login = registerInfo.Login;
                    newUser.Password = registerInfo.Password;
                    newUser.TimeCreated = DateTime.Now;

                    newUser = this.userDalManager.CreateUser(newUser);
                }
            }
            else
            {
                throw new Exception("User " + registerInfo.Login + "already exist");
            }

            return newUser;
        }
Ejemplo n.º 40
0
 public ActionResult Register()
 {
     var registerInfo = new RegisterInfo();
     return View(registerInfo);
 }
Ejemplo n.º 41
0
    //GetRegisterInfo
    public RegisterInfo GetRegisterInfo(long user_id)
    {
      DataCacheObject dco = new DataCacheObject(DataCacheType.ACTIVITY, DataCacheRegions.USERS, "GETREGISTERINFO",
                                                new object[] { user_id }, CachingExpirationTime.Minutes_30);
      RegisterInfo info = CacheRepository.Get(dco) as RegisterInfo;
      if (info != null) return info;
      info = new RegisterInfo();

      IUser user = GetUser(user_id, true);
      if (user == null) return null;

      info.ID = user.ID;
      info.Login = user.Login;
      info.Email = user.Email;
      info.ConfirmEmail = user.Email;
      info.Password = user.Password;
      info.ConfirmPassword = user.Password;
      info.RecieveNewsUpdates = user.RecieveNewsUpdates.GetValueOrDefault(false);
      info.RecieveWeeklySpecials = user.RecieveWeeklySpecials.GetValueOrDefault(false);
      info.Fax = user.Fax;      
      info.BillingLikeShipping = user.BillingLikeShipping;
      info.MobilePhone = user.MobilePhone;
      info.TaxpayerID = user.TaxpayerID;
      info.EbayID = user.EbayID;
      info.DayPhone = user.DayPhone;
      info.EveningPhone = user.EveningPhone;      
      info.EbayFeedback = user.EbayFeedback;
      info.IsModifyed = user.IsModifyed;

      IAddressCard BillingCard = user.Billing_AddressCard_ID != null ? GetAddressCard(user.Billing_AddressCard_ID.GetValueOrDefault(-1), true) : new AddressCard();
      info.BillingFirstName = BillingCard.FirstName;
      info.BillingLastName = BillingCard.LastName;
      info.BillingMIName = BillingCard.MiddleName;
      info.BillingAddress1 = BillingCard.Address1;
      info.BillingAddress2 = BillingCard.Address2;
      info.BillingCity = BillingCard.City;
      info.BillingZip = BillingCard.Zip;
      info.BillingState = BillingCard.State;
      info.BillingPhone = BillingCard.HomePhone;
      info.BillingCountry = BillingCard.Country_ID;
      info.BillingCompany = BillingCard.Company;
      info.BillingInternationalState = BillingCard.InternationalState;

      IAddressCard ShippingCard = user.Shipping_AddressCard_ID != null ? GetAddressCard(user.Shipping_AddressCard_ID.GetValueOrDefault(-1), true) : new AddressCard();
      info.ShippingFirstName = ShippingCard.FirstName;
      info.ShippingLastName = ShippingCard.LastName;
      info.ShippingMIName = ShippingCard.MiddleName;
      info.ShippingAddress1 = ShippingCard.Address1;
      info.ShippingAddress2 = ShippingCard.Address2;
      info.ShippingCity = ShippingCard.City;
      info.ShippingZip = ShippingCard.Zip;
      info.ShippingState = ShippingCard.State;
      info.ShippingWorkPhone = ShippingCard.WorkPhone;
      info.ShippingPhone = ShippingCard.HomePhone;
      info.ShippingCountry = ShippingCard.Country_ID;
      info.ShippingInternationalState = ShippingCard.InternationalState;

      IUserReference Reference1 = user.IDUserReference1.HasValue ? GetUserReferences(user.IDUserReference1.GetValueOrDefault(-1)) : new UserReference();
      info.Reference1AuctionHouse = Reference1.AuctionHouse;
      info.Reference1LastBidPlaced = Reference1.LastBidPlaced;
      info.Reference1PhoneNumber = Reference1.PhoneNumber;

      IUserReference Reference2 = user.IDUserReference2.HasValue ? GetUserReferences(user.IDUserReference2.GetValueOrDefault(-1)) : new UserReference();
      info.Reference2AuctionHouse = Reference2.AuctionHouse;
      info.Reference2LastBidPlaced = Reference2.LastBidPlaced;
      info.Reference2PhoneNumber = Reference2.PhoneNumber;

      dco.Data = info;
      CacheRepository.Add(dco);

      return info;
    }
        public virtual RegisterResponseInfo Register(RegisterInfo registerInfo)
        {
            if (registerInfo == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("registerInfo", SR.GetString(SR.PeerNullRegistrationInfo));
            }

            ThrowIfClosed("Register");

            if (!registerInfo.HasBody() || String.IsNullOrEmpty(registerInfo.MeshId))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("registerInfo", SR.GetString(SR.PeerInvalidMessageBody, registerInfo));
            }
            return Register(registerInfo.ClientId, registerInfo.MeshId, registerInfo.NodeAddress);
        }
 /// <summary>
 /// The sign up.
 /// </summary>
 private void SignUp()
 {
     try
     {
         this.registerInfo = new RegisterInfo();
         this.registerInfo.Login = this.LoginNameReg;
         this.registerInfo.Password = this.PasswordReg;
         UserManager userManager = new UserManager();
         userManager.CreateUser(this.registerInfo);
         ControlManager.GetInstance().Place("MainWindow", "mainRegion", "DashboardControl");
     }
     catch (Exception exception)
     {
         var message = exception.Message;
         this.View.ShowError(message);
     }
 }
Ejemplo n.º 44
0
    //AddUser
    public User AddUser(RegisterInfo info)
    {
      User user = new User();
      try
      {
        dataContext.Users.InsertOnSubmit(user);
        user.Login = info.Login;
        user.Email = info.Email;
        user.ConfirmationCode = Guid.NewGuid().ToString().Replace("-", "");
        user.Password = info.Password;
        user.DateRegistered = DateTime.Now;
        user.UserType = (byte)Consts.UserTypes.Buyer;
        user.IsConfirmed = false;        
        user.Fax = info.Fax;        
        user.BillingLikeShipping = info.BillingLikeShipping;
        user.Status = (byte)Consts.UserStatus.Pending;
        user.MobilePhone = info.MobilePhone;
        user.TaxpayerID = info.TaxpayerID;
        user.EbayID = info.EbayID;
        user.EbayFeedback = info.EbayFeedback;        
        user.DayPhone = info.DayPhone;
        user.EveningPhone = info.EveningPhone;
        user.IsModifyed = true;
        user.IsRecievingOutBidNotice = info.RecievingOutBidNotice;
        user.CommissionRate_ID = Consts.DefaultCommissionRate;
        user.RecieveNewsUpdates = true;
        user.RecieveWeeklySpecials = true;
        user.IsRecievingBidConfirmation = true;
        user.IsRecievingLotClosedNotice = true;
        user.IsRecievingLotSoldNotice = true;

        IDifferentRepository diff = new DifferentRepository(dataContext, CacheRepository);
        State BillingState = diff.GetStateByCode(info.BillingState);
        State ShippingState;
        long state1 = (BillingState == null) ? 0 : BillingState.ID; ;
        long state2;
        if (!info.BillingLikeShipping)
        {
          ShippingState = diff.GetStateByCode(info.ShippingState);
          state2 = (ShippingState == null) ? 0 : ShippingState.ID;
        }
        else state2 = state1;

        AddressCard ac = new AddressCard();
        dataContext.AddressCards.InsertOnSubmit(ac);
        ac.FirstName = info.BillingFirstName;
        ac.LastName = info.BillingLastName;
        ac.MiddleName = info.BillingMIName;
        ac.Address1 = info.BillingAddress1;
        ac.Address2 = info.BillingAddress2;
        ac.State = String.IsNullOrEmpty(info.BillingState) ? String.Empty : info.BillingState;
        ac.City = info.BillingCity;
        ac.Zip = info.BillingZip;
        ac.Country_ID = info.BillingCountry;
        ac.Company = info.BillingCompany;
        ac.InternationalState = info.BillingInternationalState;
        ac.HomePhone = ac.WorkPhone = info.BillingPhone;
        ac.State_ID = state1;
        user.AddressCard_Billing = ac;

        ac = new AddressCard();
        dataContext.AddressCards.InsertOnSubmit(ac);
        ac.FirstName = info.BillingFirstName;
        ac.LastName = info.BillingLastName;
        ac.MiddleName = info.BillingMIName;
        ac.Address1 = (user.BillingLikeShipping) ? info.BillingAddress1 : info.ShippingAddress1;
        ac.Address2 = (user.BillingLikeShipping) ? info.BillingAddress2 : info.ShippingAddress2;
        ac.State = (user.BillingLikeShipping) ? info.BillingState : info.ShippingState;
        ac.City = (user.BillingLikeShipping) ? info.BillingCity : info.ShippingCity;
        ac.Zip = (user.BillingLikeShipping) ? info.BillingZip : info.ShippingZip;
        ac.Country_ID = (user.BillingLikeShipping) ? info.BillingCountry : info.ShippingCountry;
        ac.InternationalState = (user.BillingLikeShipping) ? info.BillingInternationalState : info.ShippingInternationalState;
        ac.State_ID = (user.BillingLikeShipping) ? state1 : state2;
        ac.HomePhone = ac.WorkPhone = (user.BillingLikeShipping) ? info.BillingPhone : info.ShippingPhone;
        ac.State_ID = (user.BillingLikeShipping) ? state1 : state2;
        user.AddressCard_Shipping = ac;

        UserReference ur = new UserReference();
        dataContext.UserReferences.InsertOnSubmit(ur);
        ur.AuctionHouse = info.Reference1AuctionHouse;
        ur.PhoneNumber = info.Reference1PhoneNumber;
        ur.LastBidPlaced = info.Reference1LastBidPlaced;
        user.UserReference = ur;

        ur = new UserReference();
        dataContext.UserReferences.InsertOnSubmit(ur);
        ur.AuctionHouse = info.Reference2AuctionHouse;
        ur.PhoneNumber = info.Reference2PhoneNumber;
        ur.LastBidPlaced = info.Reference2LastBidPlaced;
        user.UserReference1 = ur;

        SubmitChanges();
        RemoveUserFromCache(user.ID, user.Email);
      }
      catch (Exception ex)
      {
        Logger.LogException(ex);
      }
      return user;
    }
Ejemplo n.º 45
0
        /// <summary>
        /// The validate.
        /// </summary>
        /// <param name="registerInfo">
        /// The register info.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        private bool Validate(RegisterInfo registerInfo)
        {
            if (string.IsNullOrEmpty(registerInfo.Login) || string.IsNullOrEmpty(registerInfo.Password)
                || registerInfo.Password.Contains(" ") || registerInfo.Login.Contains(" "))
            {
                return false;
            }

            return true;
        }
Ejemplo n.º 46
0
        public IServerResponse<Session> Register(RegisterInfo registerInfo)
        {
            var client = GetClient(registerInfo.ClientId);
            var encryptor = GetClientEncryptor(client);
            var hpwd = pwdEncryptor.Encrypt(registerInfo.Password);

            ServerResponse<Session> response = new ServerResponse<Session>();
            bool exists = repoUser.Query(o => o.Account == registerInfo.Account).Any();
            if (exists)
            {
                response.Status = ResponseStatus.Failed;
                response.Message = DAF.SSO.Resources.Locale(o => o.DuplicatedAccount);
                return response;
            }

            var ssoServer = serverProvider.GetObject();
            var obj = new User()
            {
                UserId = idGenerator.NewId(),
                Account = registerInfo.Account.ToLower(),
                Password = hpwd,
                ClientId = client.ClientId,
                FullName = registerInfo.FullName,
                NickName = registerInfo.NickName,
                Sex = registerInfo.Sex,
                Birthday = registerInfo.Birthday,
                Mobile = registerInfo.Mobile,
                Email = registerInfo.Email,
                Locale = LocaleHelper.Localizer.GetCurrentCultureInfo(),
                TimeZone = 8.0d,
                Theme = "Default",
                Skin = "Default",
                Status = DataStatus.Normal
            };

            if (repoUser.Insert(obj))
            {
                response.Status = ResponseStatus.Success;
                try
                {
                    trans.BeginTransaction();
                    var serverSession = repoServerSession.Query(o => o.SessionId == registerInfo.SessionId && o.CientId == client.ClientId && o.DeviceId == registerInfo.DeviceId).FirstOrDefault();
                    if (serverSession == null)
                    {
                        serverSession = new ServerSession()
                        {
                            CientId = client.ClientId,
                            SessionId = registerInfo.SessionId,
                            FromCientId = client.ClientId,
                            DeviceId = registerInfo.DeviceId,
                            DeviceInfo = registerInfo.DeviceInfo,
                            UserId = obj.UserId,
                            AccessToken = randomGenerator.Generate(config.TokenAllowedChars, config.TokenLength),
                            LastAccessTime = DateTime.Now,
                            AccessTokenExpiryTime = DateTime.Now.AddMinutes(config.SessionExpiredTimeOutMunites)
                        };
                        repoServerSession.Insert(serverSession);
                    }
                    else
                    {
                        if (serverSession.AccessTokenExpiryTime < DateTime.Now)
                        {
                            serverSession.AccessToken = randomGenerator.Generate(config.TokenAllowedChars, config.TokenLength);
                        }
                        serverSession.LastAccessTime = DateTime.Now;
                        serverSession.AccessTokenExpiryTime = DateTime.Now.AddMinutes(config.SessionExpiredTimeOutMunites);

                        repoServerSession.Update(serverSession);
                    }
                    trans.Commit();

                    response.Data = GetClientSession(client, obj, serverSession);
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    response.Status = ResponseStatus.Failed;
                    response.Message = ex.Message;
                }
            }
            else
            {
                response.Status = ResponseStatus.Failed;
                response.Message = DAF.SSO.Resources.Locale(o => o.RegisterFailed);
            }
            return response;
        }
Ejemplo n.º 47
0
    //UpdateUser
    public User UpdateUser(RegisterInfo info)
    {
      User usr = GetUser(info.ID, false);
      try
      {
        if (usr == null)
        {
          usr = new User();
          dataContext.Users.InsertOnSubmit(usr);
        }

        usr.Login = info.Login;
        usr.Email = info.Email;
        usr.Password = info.Password;
        usr.RecieveNewsUpdates = info.RecieveNewsUpdates;
        usr.RecieveWeeklySpecials = info.RecieveWeeklySpecials;
        usr.Fax = info.Fax;        
        usr.BillingLikeShipping = info.BillingLikeShipping;
        usr.MobilePhone = info.MobilePhone;
        usr.TaxpayerID = info.TaxpayerID;
        usr.EbayID = info.EbayID;
        usr.EbayFeedback = info.EbayFeedback;
        usr.DayPhone = info.DayPhone;
        usr.EveningPhone = info.EveningPhone;        
        usr.IsModifyed = true;        
        
        State BillingState, ShippingState;
        long state1, state2;

        IDifferentRepository diff = new DifferentRepository(dataContext, CacheRepository);
        BillingState = (!String.IsNullOrEmpty(info.BillingState)) ? diff.GetStateByCode(info.BillingState.ToLower()) : null;
        state1 = (BillingState == null) ? 0 : BillingState.ID;        
        if (!info.BillingLikeShipping)
        {
          ShippingState = (!String.IsNullOrEmpty(info.ShippingState)) ? diff.GetStateByCode(info.ShippingState.ToLower()) : null;
          state2 = (ShippingState == null) ? 0 : ShippingState.ID;
        }
        else state2 = state1;

        IAddressCard ac1 = GetAddressCard(usr.Billing_AddressCard_ID.GetValueOrDefault(-1), false);        
        if (ac1 == null)
        {
          ac1 = new AddressCard();
          dataContext.AddressCards.InsertOnSubmit(ac1 as AddressCard);
          usr.AddressCard_Billing = ac1 as AddressCard;
        }
        ac1.FirstName = info.BillingFirstName;
        ac1.LastName = info.BillingLastName;
        ac1.MiddleName = info.BillingMIName;
        ac1.Address1 = info.BillingAddress1;
        ac1.Address2 = info.BillingAddress2;
        ac1.City = info.BillingCity;
        ac1.State = String.IsNullOrEmpty(info.BillingState) ? String.Empty : info.BillingState;
        ac1.Zip = info.BillingZip;
        ac1.Country_ID = info.BillingCountry;
        ac1.Company = info.BillingCompany;
        ac1.InternationalState = info.BillingInternationalState;
        ac1.HomePhone = ac1.WorkPhone = info.BillingPhone;
        ac1.State_ID = state1;

        IAddressCard ac = usr.Shipping_AddressCard_ID.HasValue ? GetAddressCard(usr.Shipping_AddressCard_ID.GetValueOrDefault(-1), false) : GetAddressCard(usr.Billing_AddressCard_ID.GetValueOrDefault(-1), false);
        if (ac == null)
        {
          ac = new AddressCard();
          dataContext.AddressCards.InsertOnSubmit(ac as AddressCard);
          usr.AddressCard_Shipping = ac as AddressCard;
        }
        ac.FirstName = info.BillingFirstName;
        ac.LastName = info.BillingLastName;
        ac.MiddleName = info.BillingMIName;
        ac.Address1 = (usr.BillingLikeShipping) ? info.BillingAddress1 : info.ShippingAddress1;
        ac.Address2 = (usr.BillingLikeShipping) ? info.BillingAddress2 : info.ShippingAddress2;
        ac.City = (usr.BillingLikeShipping) ? info.BillingCity : info.ShippingCity;
        ac.State = (usr.BillingLikeShipping) ? info.BillingState : info.ShippingState;
        ac.State = String.IsNullOrEmpty(ac.State)?String.Empty:ac.State;
        ac.InternationalState = (usr.BillingLikeShipping) ? info.BillingInternationalState : info.ShippingInternationalState;
        ac.Zip = (usr.BillingLikeShipping) ? info.BillingZip : info.ShippingZip;
        ac.Country_ID = (usr.BillingLikeShipping) ? info.BillingCountry : info.ShippingCountry;
        ac.HomePhone = ac.WorkPhone = (usr.BillingLikeShipping) ? info.BillingPhone : info.ShippingPhone;
        ac.State_ID = (usr.BillingLikeShipping) ? state1 : state2;

        SubmitChanges();

        RemoveUserFromCache(usr.ID, usr.Email);
      }
      catch (Exception ex)
      {
        Logger.LogException(ex);
        throw ex;
      }
      return usr;
    }
Ejemplo n.º 48
0
        /// <summary>
        ///     The sign up.
        /// </summary>
        public void SignUpReg()
        {
            try
            {
                this.registerInfoUser = new RegisterInfo
                {
                    LoginName = this.LoginNameReg,
                    Email = this.Email,
                    Password = this.PasswordReg
                };

                //TODO 
                UserManager userManager = new UserManager();
                userManager.CreateUser(this.registerInfoUser);

                ControlManager.GetInstance().Place("MainWindow", "mainRegion", "DashboardControl");

            }
            catch (ExceptionBase exception)
            {
                var message = exception.GetMessage();
                this.View.ShowError(message);
            }
        }
Ejemplo n.º 49
0
 public IServerResponse<Session> Register(RegisterInfo registerInfo)
 {
     return serverProvider.Register(registerInfo);
 }
 public virtual new RegisterResponseInfo Register(RegisterInfo registerInfo)
 {
   return default(RegisterResponseInfo);
 }
Ejemplo n.º 51
0
        public virtual ActionResult Register(RegisterInfo model, FormCollection form)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    string redirect = "/";
                    var response = ssoClientProvider.Register(model);
                    if (response.Status == ResponseStatus.Success)
                    {
                        return Redirect(redirect);
                    }
                    else
                    {
                        ViewBag.Message = response.Message;
                    }
                }
                catch (ObjectExistsException ex)
                {
                    ModelState.AddModelError(ex.KeyNames, ex);
                }
                return View(model);
            }

            return View(model);
        }
Ejemplo n.º 52
0
 public virtual ActionResult Register()
 {
     RegisterInfo model = new RegisterInfo();
     return View(model);
 }
Ejemplo n.º 53
0
        public static ServerResponse Register(string account, string password, string confirmPassword, string email = null, string mobile = null, Sex? sex = null, DateTime? birthday = null, string fullName = null, string nickName = null)
        {
            ServerResponse response = new ServerResponse();
            RegisterInfo info = new RegisterInfo()
            {
                ClientId = CurrentClient.ClientId,
                SessionId = HttpContext.Current.Session.SessionID,
                DeviceId = HttpContext.Current.Request.UserHostAddress,
                DeviceInfo = HttpContext.Current.Request.UserAgent,
                Account = account,
                Password = password,
                ConfirmPassword = confirmPassword,
                Email = email,
                Mobile = mobile,
                Sex = sex,
                Birthday = birthday,
                FullName = fullName,
                NickName = nickName
            };

            try
            {
                var cp = IocInstance.Container.Resolve<ISSOClientProvider>();
                var r = cp.Register(info);
                response.Status = r.Status;
                response.Message = r.Message;
            }
            catch (Exception ex)
            {
                response.Status = ResponseStatus.Exception;
                response.Message = ex.Message;
            }

            return response;
        }
Ejemplo n.º 54
0
        public string Register(string PCName)  //return key
        {

            string GUID=Guid.NewGuid().ToString();
            RegisterInfo info = new RegisterInfo()
            {
                PCName = ( OperationContext.Current.Channel.RemoteAddress).ToString(),
                CallBack = OperationContext.Current.GetCallbackChannel<ISecureServiceCallBack>(),
                 Key=GUID};
            lock(this.dictClientCallBacks)
              dictClientCallBacks.Add(GUID, info);
            Console.WriteLine(info.PCName + ",registed!");

            return GUID;
          //  throw new NotImplementedException();
        }
Ejemplo n.º 55
0
        /// <summary>
        /// The already exist.
        /// </summary>
        /// <param name="registerInfo">
        /// The register info.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool AlreadyExist(RegisterInfo registerInfo)
        {
            bool result = false;
            User userResult = this.Get(registerInfo.LoginName);
            if (userResult != null)
            {
                result = true;
            }

            return result;
        }
    public ActionResult Register(string ConfirmCode)
    {
      RegisterInfo user = new RegisterInfo();
      string[] updateFields = new[] { "Login", "Email", "ConfirmEmail",  "Password", "ConfirmPassword","RecieveWeeklySpecials", "RecieveNewsUpdates",  
                "Fax", "Reference", "BillingLikeShipping","BillingFirstName", "BillingMIName", "BillingLastName", "BillingAddress1", "BillingAddress2", "BillingCity", "BillingState", "BillingZip", "BillingPhone", "BillingCountry", "ShippingFirstName", "ShippingMIName", "ShippingLastName", "ShippingAddress1", "ShippingAddress2", "ShippingCity", "ShippingState", "ShippingZip", "ShippingPhone", "ShippingWorkPhone", "ShippingCountry", "EveningPhone", "DayPhone", "BidderID", "MobilePhone", "TaxpayerID", "BillingCompany", "BillingInternationalState","ShippingInternationalState", "Reference1AuctionHouse", "Reference1LastBidPlaced", "Reference1PhoneNumber", "Reference2AuctionHouse", "Reference2LastBidPlaced", "Reference2PhoneNumber", "EbayID", "EbayFeedback", "RecievingOutBidNotice", "NoReferencesAvailable"};

      if (TryUpdateModel(user, updateFields))
      {
        user.Validate(ModelState);
        if (ModelState.IsValid)
        {
          User newUser = UserRepository.AddUser(user);
          if (newUser != null)
          {
            string confirmationUrl = AppHelper.GetSiteUrl(Url.Action("RegisterFinish", "Account", new { id = newUser.ConfirmationCode }));
            Mail.SendRegisterConfirmation(user.Email, user.Login, confirmationUrl, user.BillingFirstName, user.BillingLastName);
            return RedirectToAction("RegisterConfirm", "Account");
          }
        }
      }

      ViewData.Model = user;
      LoadLinkedUserData(user.BillingCountry, user.BillingState);
      return View();
    }
Ejemplo n.º 57
0
        /// <summary>
        /// The create.
        /// </summary>
        /// <param name="registerInfo">
        /// The register info.
        /// </param>
        /// <returns>
        /// The <see cref="User"/>.
        /// </returns>
        public User CreateUser(RegisterInfo registerInfo)
        {
            var newUser = new User();
            if (this.Validate(registerInfo))
            {
                if (!this.AlreadyExist(registerInfo))
                {
                    string salt = null;
                    string hashPassword = this.passwordManager.GeneratePasswordHash(registerInfo.Password, out salt);

                    newUser.LoginName = registerInfo.LoginName;
                    newUser.Email = registerInfo.Email;
                    newUser.Salt = salt;
                    newUser.HashPassword = hashPassword;

                    //TODO user not add to DataBase
                    this.userDalManager.AddNewUser(newUser);
                }
                else
                {
                    var userAlreadyExists = new UserAlreadyExists();
                    userAlreadyExists.Data.Add("LoginName", registerInfo.LoginName);
                    throw userAlreadyExists;
                }
            }

            return newUser;
        }
 public virtual RegisterResponseInfo Register(RegisterInfo registerInfo)
 {
     if (registerInfo == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("registerInfo", System.ServiceModel.SR.GetString("PeerNullRegistrationInfo"));
     }
     this.ThrowIfClosed("Register");
     if (!registerInfo.HasBody() || string.IsNullOrEmpty(registerInfo.MeshId))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("registerInfo", System.ServiceModel.SR.GetString("PeerInvalidMessageBody", new object[] { registerInfo }));
     }
     return this.Register(registerInfo.ClientId, registerInfo.MeshId, registerInfo.NodeAddress);
 }
Ejemplo n.º 59
0
        /// <summary>
        /// The validate.
        /// </summary>
        /// <param name="registerInfo">
        /// The register info.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool Validate(RegisterInfo registerInfo)
        {
            return true;

        }
 public override object Register(string meshId, PeerNodeAddress nodeAddress, TimeSpan timeout)
 {
     if (this.opened)
     {
         long scopeId = -1L;
         bool flag = false;
         if (nodeAddress.IPAddresses.Count == 0)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(System.ServiceModel.SR.GetString("MustRegisterMoreThanZeroAddresses")));
         }
         foreach (IPAddress address in nodeAddress.IPAddresses)
         {
             if (address.IsIPv6LinkLocal)
             {
                 if (scopeId == -1L)
                 {
                     scopeId = address.ScopeId;
                 }
                 else if (scopeId != address.ScopeId)
                 {
                     flag = true;
                     break;
                 }
             }
         }
         List<IPAddress> list = new List<IPAddress>();
         foreach (IPAddress address2 in nodeAddress.IPAddresses)
         {
             if (!flag || (!address2.IsIPv6LinkLocal && !address2.IsIPv6SiteLocal))
             {
                 list.Add(address2);
             }
         }
         if (list.Count == 0)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new CommunicationException(System.ServiceModel.SR.GetString("AmbiguousConnectivitySpec")));
         }
         ReadOnlyCollection<IPAddress> ipAddresses = new ReadOnlyCollection<IPAddress>(list);
         this.meshId = meshId;
         this.nodeAddress = new PeerNodeAddress(nodeAddress.EndpointAddress, ipAddresses);
         RegisterInfo registerInfo = new RegisterInfo(this.clientId, meshId, this.nodeAddress);
         IPeerResolverClient proxy = this.GetProxy();
         try
         {
             proxy.OperationTimeout = timeout;
             RegisterResponseInfo info2 = proxy.Register(registerInfo);
             this.registrationId = info2.RegistrationId;
             this.timer.Set(info2.RegistrationLifetime);
             this.defaultLifeTime = info2.RegistrationLifetime;
             proxy.Close();
         }
         finally
         {
             proxy.Abort();
         }
     }
     return this.registrationId;
 }