public List <DTO_User> LoginUser(DTO_Login login) { DTO_User user = new DTO_User(); List <DTO_User> users = new List <DTO_User>(); using (DB_111206_scrapEntities db = new DB_111206_scrapEntities()) { var match = db.Users.Where(u => u.email == login.Email && u.pwd == login.Password).FirstOrDefault(); if (match != null) { user.id = match.userID; user.LastName = match.lName; user.FirstName = match.fName; user.Email = match.email; user.Password = match.pwd; user.Phone = match.phone; users.Add(user); UserLogin userlogin = new UserLogin(); userlogin.userID = user.id; userlogin.lat = login.Latutude; userlogin.lon = login.Longitude; userlogin.logInDateTime = DateTime.Now; db.UserLogins.Add(userlogin); db.SaveChanges(); // email("New user login", "Hello, World!"); } } return(users); }
private void button1_Click(object sender, EventArgs e) { try { DTO_Login obj = new DTO_Login(); obj.Usuario = textBox1.Text; obj.Senha = textBox2.Text; MessageBox.Show(BLL_Login.ValidarLogin(obj)); // Retorna uma string /*string resultado = BLL_Login.ValidarLogin(obj)); if(resultado == "Sucesso") { // Tela Usuário } else { MessageBox.Show(resultado); } } catch(Exception ex) { MessageBox.Show(ex.Message); }*/ }
public DTO_User VerifyUserLogin(DTO_Login uL) { //DB Connection DB_111206_scrapEntities db = new DB_111206_scrapEntities(); //get table contents var listUsers = db.Users.ToList(); var tempUser = listUsers.Where(x => x.email == uL.Email && x.pwd == uL.Password).FirstOrDefault(); //create list to return with sql objects DTO_User user = new DTO_User(); if (tempUser != null) { DTO_User verifiedUser = new DTO_User { id = tempUser.userID, FirstName = tempUser.fName, LastName = tempUser.lName, Phone = tempUser.phone, Password = tempUser.pwd }; //Add user to list for returning user = verifiedUser; //create odbject for UserLogins var loginItem = new Scrap_DAL.UserLogin { userID = tempUser.userID, lat = Convert.ToDouble(tempUser.lat), lon = Convert.ToDouble(tempUser.lon), logInDateTime = DateTime.Now }; db.UserLogins.Add(loginItem); db.SaveChanges(); } return(user); }
private void btnLogin_Click_2(object sender, EventArgs e) { BUS_Login login = new BUS_Login(); DTO_Login lg = new DTO_Login(txtid.Text, txtpw.Text); int ketQua = login.IsLogin(lg); if (ketQua == 1) { this.Hide(); FrmHome frmHome = new FrmHome(); frmHome.ShowDialog(); this.Close(); } else if (ketQua == 2) { DialogResult dlr = MessageBox.Show("Bạn chưa nhập Username hoặc Password ?", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dlr == DialogResult.Yes) { Application.Exit(); } } else if (ketQua == 0) { MessageBox.Show("Mật khẩu hoặc tài khoản không đúng!", "Thông Báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); } }
//WEB SERVICE FUNCTIONS/////////////////////////////////////////////////////////////////////// public async Task <DTO_User> WS_Login(DTO_Login login) { DTO_User temp = new DTO_User(); try { HttpResponseMessage response = await client.PostAsJsonAsync(string.Format(@"{0}{1}", URL, "Login"), login); response.EnsureSuccessStatusCode(); var json = await response.Content.ReadAsStringAsync(); var des = (Wrapper <DTO_User>)Newtonsoft.Json.JsonConvert.DeserializeObject(json, typeof(Wrapper <DTO_User>)); var userList = des.Data.ToList(); if (userList.Count == 1) { temp = userList.FirstOrDefault(); } else { temp = null; } } catch (Newtonsoft.Json.JsonSerializationException hre) { Debug.WriteLine(hre.Message); } return(temp); }
private void btnEntrar_Click(object sender, EventArgs e) { try { DTO_Login obj = new DTO_Login(); obj.Usuario = Email.Text; obj.Senha = Senha.Text; DTO_Usuario obj2 = new DTO_Usuario(); obj2 = BLL_Login.ValidarLogin(obj); if (obj2.StatusLogin == true) { if (obj2.Ativo != "ativo") { MessageBox.Show("Seu usuário está desativado", "ERRO LOGIN", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { //Iniciar a tela do usuário switch (obj2.Tipo) { case "adm": this.Hide(); Form4 telaAdm = new Form4(obj2); telaAdm.ShowDialog(); this.Close(); break; case "funcionario": this.Hide(); Form4 telaFun = new Form4(obj2); telaFun.ShowDialog(); this.Close(); break; case "cliente": this.Hide(); Form4 telaCliente = new Form4(obj2); telaCliente.ShowDialog(); this.Close(); break; default: MessageBox.Show("Contate o suporte", "ERRO LOGIN", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } } } else { MessageBox.Show("Credenciais inválidas", "ERRO LOGIN", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show(ex.Message, "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private async void SignInButton_Click(object sender, RoutedEventArgs e) { BLL.BLL b = new BLL.BLL(); DTO_Login u = new DTO_Login(); u.username = Email.Text; u.password = Password.Text; var result = await b.Login(u); }
public static DTO_Usuario ValidarLogin(DTO_Login obj) { try //inicia o bloco de tratamento de exception { string script = "SELECT * FROM Usuario WHERE(userName = @login OR email = @login) " + "AND senha = @senha AND ativo = 'ativo'; "; // cria a string com consulta sql SqlCommand cm = new SqlCommand(script, conexao.Conectar()); //cria o comando para rodar a instrução, passando instrução sql e conexão cm.Parameters.AddWithValue("@login", obj.Usuario); cm.Parameters.AddWithValue("@senha", obj.Senha); //substitui as variaveis na instrução sql pelos valores digitados pelo usuario SqlDataReader dados = cm.ExecuteReader(); //roda a instrução sql e atribui resultado no SqlDataReader DTO_Usuario usuario = new DTO_Usuario(); while (dados.Read()) //le a proxima linha do resultado da sua instrução { if (dados.HasRows) //verifica se existe a linha com as credenciais { usuario.idUsuario = int.Parse(dados["idUsuario"].ToString()); usuario.Nome = dados["nome"].ToString(); usuario.Email = dados["email"].ToString(); usuario.UserName = dados["userName"].ToString(); usuario.Senha = dados["senha"].ToString(); usuario.Tipo = dados["tipo"].ToString(); usuario.Ativo = dados["ativo"].ToString(); usuario.CPF = dados["CPF"].ToString(); usuario.StatusLogin = true; return(usuario); } } usuario.StatusLogin = false; return(usuario); } catch (Exception ex) //esse bloco é executado caso aconteça exceção no bloco try { //ex = new Exception("erro"); throw new Exception(ex.Message); } finally { if (conexao.Conectar().State != ConnectionState.Closed) { conexao.Conectar().Close(); } } }
public static DTO_Entidade ValidarLogin(DTO_Login obj) { try { string script = "SELECT * FROM tbl_Usuario WHERE(nick = @login OR email = @login) AND senha = @senha AND ativo = 'Ativo' "; SqlCommand cm = new SqlCommand(script, Conexao.Conectar()); //substitui as variaveis na instruçao sql pelos valores digitados pelo usuario cm.Parameters.AddWithValue("@login", obj.nome); cm.Parameters.AddWithValue("@senha", obj.senha); SqlDataReader dados = cm.ExecuteReader(); //roda a intruçao sql e atribui resultado no SqlDataReader DTO_Entidade objent = new DTO_Entidade(); while (dados.Read()) //le a proxima linha do resultado da sua instruçao { if (dados.HasRows) //se der certo vai aparecer a message de conexao feita { objent.idUser = int.Parse(dados["idUser"].ToString()); objent.nome = dados["nome"].ToString(); objent.email = dados["email"].ToString(); objent.nick = dados["nick"].ToString(); objent.senha = dados["senha"].ToString(); objent.tipo = dados["tipo"].ToString(); objent.ativo = dados["ativo"].ToString(); objent.cpf = dados["cpf"].ToString(); objent.loginStatus = true; return(objent); } } objent.loginStatus = false; return(objent); } catch (Exception ex) { throw new Exception("Erro de conexão, contate o suporte! " + ex.Message); } finally //finally acontece independente se acontece o try ou catch { if (Conexao.Conectar().State != ConnectionState.Closed) //testando o estado da conexao, se é diferente de fechado { Conexao.Conectar().Close(); } } }
private void button1_Click(object sender, EventArgs e) { try { DTO_Login obj = new DTO_Login(); obj.Usuario = textBox1.Text; obj.Senha = textBox2.Text; DTO_Usuario obj2 = new DTO_Usuario(); obj2 = BLL_Login.ValidarLogin(obj); if (obj2.StatusLogin == true) { if (obj2.Ativo != "Ativo") { MessageBox.Show("Seu usuario está desativado! Contate o suporte técnico", "ERRO LOGIN", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { switch (obj2.Tipo) { case "administrador": case "funcionario": case "operador": this.Hide(); Form4 telaADM = new Form4(obj2); telaADM.ShowDialog(); this.Close(); break; case "cliente": this.Hide(); Form5 telaCliente = new Form5(obj2); telaCliente.ShowDialog(); this.Close(); break; default: MessageBox.Show("Contate o suporte técnico", "ERRO LOGIN", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } } } else { MessageBox.Show("Credenciais Inválidas", "ERRO LOGIN", MessageBoxButtons.OK, MessageBoxIcon.Error); } textBox1.Clear(); textBox2.Clear(); } catch (Exception ex) { MessageBox.Show(ex.Message, "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static DTO_Usuario ValidarLogin(DTO_Login obj) { if (string.IsNullOrWhiteSpace(obj.Usuario)) { throw new Exception("Campo usuário vazio!"); } if (string.IsNullOrWhiteSpace(obj.Senha)) { throw new Exception("Campo senha vazio!"); } return(DAL_Login.ValidarLogin(obj)); }
/// <summary> /// 登录 /// </summary> private async void Login() { Loading.Visibility = Visibility.Visible; DTO_User du = new DTO_User(); //获取帐号 du._Number = username.Text; //获取登录密码 du._Pass = password.Password; if (!string.IsNullOrEmpty(du._Number) && !string.IsNullOrEmpty(du._Pass)) { //获取本机ip du._IP = Dns.GetHostAddresses(Dns.GetHostName()).GetValue(1).ToString(); //尝试登陆 try { //传递客户端实现服务器接口消息 InstanceContext ic = new InstanceContext(new ISC_Implement(this)); //建立通讯 AL_ServiceClient alsc = new AL_ServiceClient(ic); //请求服务器,验证登录信息 DTO_Login dl = await alsc.LoginAsync(du); //判断是否登录成功 if (dl.IsLogin) { //创建登录成功窗体对象 m = new Main(this, dl, alsc); //显示 m.Show(); } else { //new MyMessageBox("系统提示", dl.LoginMess).Show(); MessageBox.Show(dl.LoginMess); } } catch (Exception) { } } else { //new MyMessageBox("系统提示", "用户名和密码不能为空").Show(); MessageBox.Show("用户名和密码不能为空"); } Loading.Visibility = System.Windows.Visibility.Collapsed; }
public DataSet Login(DTO_Login account) { string sql = "Exec DangNhap @UserName, @PassWord"; SqlParameter[] para = new SqlParameter[] { new SqlParameter("@UserName", account.UserName), new SqlParameter("@PassWord", account.PassWord), }; DataAccess data = new DataAccess(); return(data.GetDataSet(sql, para)); }
public bool ValidarLogin(DTO_Login objLogin) { if (string.IsNullOrWhiteSpace(objLogin.Usuario)) { throw new Exception("Por favor digitar e-mail e usuario"); } if (string.IsNullOrWhiteSpace(objLogin.Senha)) { throw new Exception("por favor digitar senha"); } Conexao.Conectar(); return(true); }
private async void BTN_LoginLogin_Click(object sender, RoutedEventArgs e) { if (TBox_LoginEmail.Text != "" && TBox_LoginPassword.Text != "") { //Validate that it's actually an email address DTO_Login login = new DTO_Login(); login.Email = TBox_LoginEmail.Text; login.Password = TBox_LoginPassword.Text; //Figure out how to pull real location login.Latitude = 200; login.Longitude = 200; DTO_User user = new DTO_User(); var temp = await WS_Login(login); user = temp; if (user != null) { S_User.Instance.userID = user.ID; S_User.Instance.displayName = user.DisplayName; S_User.Instance.emailAddress = user.EmailAddress; S_User.Instance.picture = user.Picture; await WS_GetGameStatuses(); await WS_GetDrawCategories(); DrawPage_Home(); } else { DrawPage_Login(); output.Text = "Invalid Login"; } } else { DrawPage_Login(); if (TBox_LoginEmail.Text == "") { TBox_LoginEmail.Text = "Required"; } if (TBox_LoginPassword.Text == "") { TBox_LoginPassword.Text = "Required"; } output.Text = "Invalid Login"; } }
public HttpResponseMessage IsExist(DTO_Login parameters) { try { var user = BLL.BllFunctions.LogInFunc.IsExist(parameters.Email, parameters.Code); if (user == null) { return(Request.CreateErrorResponse(HttpStatusCode.Unauthorized, "הנתונים שגויים")); } return(Request.CreateResponse(HttpStatusCode.OK, user)); } catch (Exception) { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } }
public static DTO_Entidade ValidarLogin(DTO_Login ObjLog) { if (string.IsNullOrWhiteSpace(ObjLog.nome)) { throw new Exception("Campo nome vazio"); } if (string.IsNullOrWhiteSpace(ObjLog.senha)) { throw new Exception("Campo senha vazio"); } Conexao.Conectar(); return(DAL_Login.ValidarLogin(ObjLog)); }
private void button1_Click(object sender, EventArgs e) { try { DTO_Login obj = new DTO_Login(); BLL_Login obj2 = new BLL_Login(); obj.Usuario = textBox1.Text; obj.Senha = textBox2.Text; if (obj2.ValidarLogin(obj) == true) { MessageBox.Show("deu certo ", "aviso", MessageBoxButtons.OK, MessageBoxIcon.None); } } catch (Exception ex) { MessageBox.Show(ex.Message, "aviso", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public int IsLogin(DTO_Login lg) { try { DataProvider dp = new DataProvider(); dp.getConnect(); dp.Connect(); SqlCommand cmd = dp.CountLogin(); cmd.Parameters.Add(new SqlParameter("@username", lg.userName)); cmd.Parameters.Add(new SqlParameter("@password", lg.passWord)); int kq = (int)cmd.ExecuteScalar(); //tra ve so nguyen 1, 0 dp.DisConnect(); return(kq); // đăng nhập thàng công = 1, ko thành công = 0; } catch (SqlException ex) { throw ex; } }
public static string ValidarLogin(DTO_Login obj) { try //Inicia o bloco de tratamento de exception { string script = "SELECT * FROM Usuario WHERE(userName = @login OR email = @login) AND senha = @senha AND ativo = 'ativo';"; // Cria a string com consulta de sql SqlCommand cm = new SqlCommand(script, Conexao.Conectar()); //Cria o comando para rodar a instrução, passando instrução sql e conexão cm.Parameters.AddWithValue("@login", obj.Usuario); cm.Parameters.AddWithValue("@senha", obj.Senha); // Substitui as váriaveis na instrução sql pelos valores digitados pelo usuário SqlDataReader dados = cm.ExecuteReader(); // Roda a instrução sql e atribui resultado no SqlDataReader while (dados.Read()) // Lê a próxima linha do resultado da sua instrução { if (dados.HasRows) // Verifica se existe a linha com as credenciais { return("Sucesso"); } } return("Credenciais Inválidas"); } catch (Exception ex) // Esse bloco é executado caso aconteça exceção no bloco try { //ex = new Exception("erro"); throw new Exception(ex.Message); } finally { if (Conexao.Conectar().State != ConnectionState.Closed) { Conexao.Conectar().Close(); } } }
//sử lý đăng nhập thành công hay ko, thành công trả về 1, ko thành công trả về 0 public int IsLogin(DTO_Login lg) { if (lg.userName == "User Name" || lg.passWord == "Password") { return(2); } else { DAO_Login lgDAO = new DAO_Login(); if (lgDAO.IsLogin(lg) == 1) { return(1); } else { return(0); } } }
public List <DTO_User> Login(DTO_Login login) { List <DTO_User> users = new List <DTO_User>(); using (DB_122744_doodleEntities db = new DB_122744_doodleEntities()) { var sqllist = db.users.Where(c => c.Email.ToLower() == login.Email.ToLower() && c.Password == login.Password).ToList(); foreach (var s in sqllist) { DTO_User u = new DTO_User(); u.DisplayName = s.DisplayName; if (s.Active.HasValue) { u.Active = s.Active.Value; } u.EmailAddress = s.Email; u.ID = s.UserID; u.Password = s.Password; u.Picture = s.Picture; users.Add(u); } if (sqllist.Count == 1) { userLogin sqlobj = new userLogin(); sqlobj.UserID = sqllist[0].UserID; sqlobj.Latitude = login.Latitude; sqlobj.Longitude = login.Longitude; sqlobj.LoginDateTime = System.DateTime.Now; db.userLogins.Add(sqlobj); db.users.Find(users[0].ID).Active = true; db.SaveChanges(); } else { users.Clear(); } } return(users); }
private AL_ServiceClient alsc; //通讯通道对象 /// <summary> /// 初始化数据 /// </summary> /// <param name="w">登陆窗口</param> /// <param name="_mess">登陆返回的个人信息及好友信息</param> /// <param name="_alsc">登陆用户的通讯通道</param> public Main(Window w, DTO_Login _mess, AL_ServiceClient _alsc) { //获取通讯通道 alsc = _alsc; InitializeComponent(); loginwindow = w; //隐藏登录窗口 w.Hide(); this.Closed += Main_Closed; //添加自己的信息 LoadingMyMess(_mess.MyMess); //将所有信息存入窗体的tag中 this.Tag = _mess; LoadingFriends(_mess.MyGroup.ToList(), _mess.MyFriends.ToList()); //加载历史聊天记录 List <string> lis = FilesHelper.FileHelper.GetMessageFileName(_mess.MyMess.UI_Number); if (lis.Count > 0) { List <DTO_Friend> flis = new List <DTO_Friend>(); foreach (var item in lis) { if (_mess.MyFriends.Where(a => a._Number.Equals(item)).ToList().Count > 0) { flis.AddRange(_mess.MyFriends.Where(a => a._Number.Equals(item)).ToList()); } } mview.Children.Add(LoadingFriendMess(flis)); } }
private void btn_login_Click(object sender, EventArgs e) { try { DTO_Login obj = new DTO_Login(); obj.Usuario = txtUsuario.Text; obj.Senha = txtSenha.Text; MessageBox.Show(BLL_Login.ValidarLogin(obj)); this.Hide(); Home home = new Home(); home.ShowDialog(); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnLogin_Click(object sender, EventArgs e) { BUS_Login login = new BUS_Login(); DTO_Login lg = new DTO_Login(txtUsername.Text, txtPassWord.Text); int ketQua = login.IsLogin(lg); if (ketQua == 1) { this.Hide(); FrmHome frmHome = new FrmHome(); frmHome.ShowDialog(); this.Close(); } else if (ketQua == 2) { MessageBox.Show("Bạn chưa nhập user name, password!", "Thống báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (ketQua == 0) { MessageBox.Show("Mật khẩu hoặc tài khoản không đúng!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static string ValidarLogin(DTO_Login obj) { try { string script = "SELECT * FROM Usuario WHERE(userName = @login OR email = @login)" + "AND senha = @senha"; SqlCommand cm = new SqlCommand(script, Conexao.Conectar()); //sempre nessa ordem, chamando o metodo de conectar cm.Parameters.AddWithValue("@login", obj.Usuario); cm.Parameters.AddWithValue("@senha", obj.Senha); //substitui as variaveis na instruçao sql pelos valores digitados pelo usuario SqlDataReader dados = cm.ExecuteReader(); //roda a intruçao sql e atribui resultado no SqlDataReader while (dados.Read()) //le a proxima linha do resultado da sua instruçao { if (dados.HasRows) //se der certo vai aparecer a message de conexao feita { return("login realizado com sucesso!"); } } throw new Exception("Usuário ou senha inválidos!"); } catch (Exception ex) { throw new Exception("Erro de conexão, contate o suporte! " + ex.Message); } finally //finally acontece independente se acontece o try ou catch { if (Conexao.Conectar().State != ConnectionState.Closed) //testando o estado da conexao, se é diferente de fechado { Conexao.Conectar().Close(); } } }
private void btn_Log_Click(object sender, EventArgs e) { try { DTO_Login objLog = new DTO_Login(); objLog.nome = name_Log.Text; objLog.senha = pass_Log.Text; DTO_Entidade objEnt = new DTO_Entidade(); objEnt = BLL_Login.ValidarLogin(objLog); if (objEnt.loginStatus) { if (objEnt.tipo == "Cliente") { this.Hide(); Home hm = new Home(objEnt); hm.ShowDialog(); this.Close(); } else if (objEnt.tipo == "Admin" || objEnt.tipo == "Funcionario" || objEnt.tipo == "Operador") { this.Hide(); Adm adm = new Adm(objEnt); adm.ShowDialog(); this.Close(); } } else { MessageBox.Show("Usuario ou Senha invalidos", "ERRO LOGIN", MessageBoxButtons.OK); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btLogin_Click(object sender, EventArgs e) { DTO_Login account = new DTO_Login(); account.UserName = txtUserName.Text; account.PassWord = txtPassword.Text; SQLAction action = new SQLAction(); DataSet result = action.Login(account); if (result.Tables.Count > 0 && result.Tables[0].Rows.Count > 0) { MessageBox.Show("Đăng nhập thành công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); MenuForm menu = new MenuForm(); this.Hide(); menu.USERNAME = result.Tables[0].Rows[0][0].ToString(); menu.ShowDialog(); this.Close(); } else { MessageBox.Show("Tên tài khoản hoặc mật khẩu không đúng!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error); load(); } }
public async Task <DTO_UserInfo> Login(DTO_Login token) { var prod = await GetData <DTO_Login, DTO_UserInfo>(token, "WS_LoginValidation"); return(prod); }
public async void BTN_RegisterSubmit_Click(object sender, RoutedEventArgs e) { if (TBox_RegisterEmail.Text != "" && TBox_RegisterPassword.Text != "" && TBox_RegistrationPicture.Text != "" && TBox_RegisterUserName.Text != "") { DTO_User user = new DTO_User(); user.EmailAddress = TBox_RegisterEmail.Text; user.Password = TBox_RegisterPassword.Text; user.Picture = TBox_RegistrationPicture.Text; user.DisplayName = TBox_RegisterUserName.Text; user = await WS_RegisterUser(user); if (user != null) { DTO_Login login = new DTO_Login(); login.Email = user.EmailAddress; login.Password = user.Password; login.Latitude = 400; login.Longitude = 200; user = await WS_Login(login); if (user != null) { S_User.Instance.userID = user.ID; S_User.Instance.displayName = user.DisplayName; S_User.Instance.emailAddress = user.EmailAddress; S_User.Instance.picture = user.Picture; DrawPage_Home(); } else { DrawPage_Login(); output.Text = "Unable to Login"; } } else { output.Visibility = Visibility.Visible; output.Text = "Email Already In Use"; } } else { if (TBox_RegisterEmail.Text == "") { TBox_RegisterEmail.Text = "Required"; } if (TBox_RegisterPassword.Text == "") { TBox_RegisterPassword.Text = "Required"; } if (TBox_RegistrationPicture.Text == "") { TBox_RegistrationPicture.Text = "Required"; } if (TBox_RegisterUserName.Text == "") { TBox_RegisterUserName.Text = "Required"; } } }