private async void SinglUp_OnClick(object sender, RoutedEventArgs e) { if (Password.Password == PasswordSecond.Password && Password.Password.Replace(" ", "") != "" && Name.Text.Replace(" ", "") != "" && Email.Text.Replace(" ", "") != "") { RegistrationObject sendParams = new RegistrationObject() { Name = Name.Text, EMail = Email.Text, Password = Password.Password }; DataExchangeWithServer registrationSend = new DataExchangeWithServer("Registration", "POST", JsonConvert.SerializeObject(sendParams), "application/json", true); string result = await registrationSend.SendToServer(); if (result == null) { return; } MessageBox.Show("OK!", "Result"); this.Close(); } else { Error.Visibility = Visibility.Visible; } }
public JsonResult register(RegistrationObject obj) { try { var conn = _context.Database.GetDbConnection(); if (conn.State != System.Data.ConnectionState.Open) { conn.Open(); } using (var command = conn.CreateCommand()) { string sql = "exec spDeviceRegister @tokenType = '{0}', @token = '{1}'"; sql = String.Format(sql, obj.tokenType, obj.token); command.CommandText = sql; command.CommandType = System.Data.CommandType.Text; string rv = command.ExecuteScalar().ToString(); if (rv != "OK") { return(new JsonResult("Error")); } return(new JsonResult("OK")); } } catch (Exception ex) { return(new JsonResult("Error: " + ex.Message)); } }
/// <summary> /// Registers the provided implementation for the provided interface in the container. /// </summary> /// <typeparam name="TInterface">The interface to register.</typeparam> /// <typeparam name="TImplementation">The class that implements the provided interface</typeparam> public void Register <TInterface, TImplementation>() where TInterface : class where TImplementation : TInterface, new() { RegistrationObject registrationObject = new RegistrationObject(typeof(TImplementation).GetConstructor(new Type[] { })); _registrations.AddOrUpdate(typeof(TInterface), registrationObject, (k, v) => registrationObject); }
/// <summary> /// Registers the provided instance factory for the provided interface in the container /// </summary> /// <typeparam name="TInterface">The type of interface to register</typeparam> /// <param name="factory">The factory to generate new instances of the provided instance type</param> public void RegisterFactory <TInterface>(Func <object[], object> factory) { RegistrationObject registrationObject = new RegistrationObject(factory); _registrations.AddOrUpdate(typeof(TInterface), registrationObject, (k, v) => registrationObject); }
/// <summary> /// Registers the provided instance factory for the provided interface in the container /// </summary> /// <param name="interfaceType">The type of interface to register</param> /// <param name="factory">The factory to generate new instances of the provided instance type</param> public void RegisterFactory(Type interfaceType, Func <object[], object> factory) { RegistrationObject registrationObject = new RegistrationObject(factory); _registrations.AddOrUpdate(interfaceType, registrationObject, (k, v) => registrationObject); }
/// <summary> /// Registers the provided implemented object for the provided interface in the container /// </summary> /// <param name="interfaceType">The type of the interface to register</param> /// <param name="implementation">The implementated object to use in the container</param> public void Register(Type interfaceType, object implementation) { RegistrationObject registrationObject = new RegistrationObject(implementation); _registrations.AddOrUpdate(interfaceType, registrationObject, (k, v) => registrationObject); }
/// <summary> /// Registers the provided implementation for the provided interface in the container /// </summary> /// <param name="interfaceType">The type of the interface to register</param> /// <param name="implementationType">The type of the class that implements the provided interface</param> public void Register(Type interfaceType, Type implementationType) { RegistrationObject registrationObject = new RegistrationObject(implementationType.GetConstructor(new Type[] { })); _registrations.AddOrUpdate(interfaceType, registrationObject, (k, v) => registrationObject); }
/// <summary> /// Registers the provided implementaiton for the provided interface in the container. /// </summary> /// <typeparam name="TInterface">The interface to register.</typeparam> /// <param name="implementation">The implemented object to use in the container</param> public void Register <TInterface>(object implementation) { RegistrationObject registrationObject = new RegistrationObject(implementation); _registrations.AddOrUpdate(typeof(TInterface), registrationObject, (k, v) => registrationObject); }
public string Registration(RegistrationObject regInfo) { _db.RegistsAccount(regInfo.Name, regInfo.EMail, regInfo.Password); return(JsonConvert.SerializeObject(true)); }