private Contact GenerateContactObject() { contact.Name = txt_name.Text.Trim(); contact.Email = txt_email.Text.Trim(); contact.Phone = txt_phone.Text.Trim(); contact.Image = commonUtil.BitmapToBase64(cpb_userimage.Image); contact.AddressLine1 = this.GetDynamicTextBoxValues("dynamictxt_addressline1"); contact.AddressLine2 = this.GetDynamicTextBoxValues("dynamictxt_addressline2"); contact.State = this.GetDynamicTextBoxValues("dynamictxt_state"); contact.City = this.GetDynamicTextBoxValues("dynamictxt_city"); contact.Zipcode = this.GetDynamicTextBoxValues("dynamictxt_zip"); return(contact); }
private async void btn_register_Click(object sender, EventArgs e) { String id = commonUtil.generateUserId("user"); PictureBox picture = commonUtil.addLoaderImage(this.btn_register.Location.X + 205, this.btn_register.Location.Y + 2); btn_register.Enabled = false; Controls.Add(picture); User user = new User() { UserId = id, Email = txt_email.Text.Trim(), Username = txt_username.Text.Trim(), Firstname = txt_firstname.Text.Trim(), Lastname = txt_lastname.Text.Trim(), Image = commonUtil.BitmapToBase64(cpb_userimage.Image) }; UserCredential userCredential = new UserCredential() { UserId = id, Password = txt_password.Text.Trim(), Email = txt_email.Text.Trim(), Username = txt_username.Text.Trim() }; bool task = await Task.Run(() => this.DoValidations()); if (task) { bool register = await Task.Run(() => userHelper.AddUser(user, userCredential)); if (task) { Controls.Remove(picture); Login login = new Login(); login.Show(); this.Close(); } else { this.Controls.Remove(picture); this.btn_register.Enabled = true; } } else { this.Controls.Remove(picture); this.btn_register.Enabled = true; } }
private Contact GenerateContactObject() { Contact contact = new Contact() { ContactId = commonUtil.generateUserId("contact"), Name = txt_name.Text.Trim(), Email = txt_email.Text.Trim(), Phone = txt_phone.Text.Trim(), Image = commonUtil.BitmapToBase64(cpb_userimage.Image), AddressLine1 = this.GetDynamicTextBoxValues("dynamictxt_addressline1"), AddressLine2 = this.GetDynamicTextBoxValues("dynamictxt_addressline2"), State = this.GetDynamicTextBoxValues("dynamictxt_state"), City = this.GetDynamicTextBoxValues("dynamictxt_city"), Zipcode = this.GetDynamicTextBoxValues("dynamictxt_zip"), UserId = Application.UserAppDataRegistry.GetValue("userID").ToString() }; return(contact); }