Exemplo n.º 1
0
 private void BtnSave_Click_1(object sender, EventArgs e)
 {
     if (Metotlar.BosAlanVarMi(grpRegister))
     {
         MessageBox.Show("Lütfen tüm boş alanları doldurunuz!");
         return;
     }
     else if (txtTcNo.Text.Length != 11)
     {
         MessageBox.Show("TC kimlik numarasını 11 haneli olarak giriniz.");
     }
     else
     {
         if (Connection.IsUserNameAvailable(txtUserName.Text))
         {
             if (Connection.CustomerSearch(txtTcNo.Text) == -1)
             {
                 Connection.AddCustomer(txtFirstName.Text, txtLastName.Text, txtTcNo.Text);
                 Connection.AddAppUser(Connection.CustomerSearch(txtTcNo.Text) /*CustomerID*/, txtUserName.Text, txtPassword.Text);
                 MessageBox.Show("Kullanıcı eklendi.");
                 this.Close();
             }
             else
             {
                 if (Connection.IsAppUser(Connection.CustomerSearch(txtTcNo.Text)))
                 {
                     MessageBox.Show("Bu TC No'ya ait kullanıcı bulunmaktadır.");
                 }
                 else
                 {
                     Connection.AddAppUser(Connection.CustomerSearch(txtTcNo.Text), txtUserName.Text, txtPassword.Text);
                     MessageBox.Show("Kullanıcı eklendi.");
                     this.Close();
                 }
             }
         }
         else
         {
             MessageBox.Show("Bu kulanıcı adı daha önce alınmıştır. Lütfen farklı bir kullanıcı adı giriniz.");
         }
     }
 }