Esempio n. 1
0
 private void BT_LogIn_Click(object sender, EventArgs e)
 {
     Real_Ph    = TB_Phone_LogIn.Text;
     Real_Pass  = TB_Password_LogIn.Text;
     Phone_Temp = Real_Ph;
     try
     {
         FileStream   fs = new FileStream(TB_Phone_LogIn.Text + "_profile.txt", FileMode.Open, FileAccess.Read);
         StreamReader sr = new StreamReader(fs);
         Read_All     = sr.ReadToEnd();
         Read_All_Arr = Read_All.Split(Delimiter_Line);
         sr.Close();
         fs.Close();
         Pass_Phone       = Read_All_Arr[3];
         Pass_Password    = Read_All_Arr[8];
         Confirm_Password = TB_Password_LogIn.Text;
         Confirm_Phone    = TB_Phone_LogIn.Text;
         //label12.Text = Pass_Phone;
         //label13.Text = Pass_Password;
         //TB_Phone_LogIn.Text = Pass_Phone;
         //TB_Password_LogIn.Text = Pass_Password;
         //MessageBox.Show("sek", "sek", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         if ((TB_Phone_LogIn.Text.ToLower().Trim() == Pass_Phone.ToString().ToLower().Trim()) && (TB_Password_LogIn.Text.ToLower().Trim() == Pass_Password.ToString().ToLower().Trim()))
         {
             MessageBoxButtons a       = MessageBoxButtons.OK;
             DialogResult      result3 = MessageBox.Show("Logging in account successfully !", "Information Center", a, MessageBoxIcon.Information);
             if (result3 == DialogResult.OK)
             {
                 Form1   f1_ = new Form1(TB_Phone_LogIn.Text.ToLower().Trim());
                 MCash   f2_ = new MCash(a_, b_, TB_Phone_LogIn.Text.ToLower().Trim());
                 History f3_ = new History(TB_Phone_LogIn.Text.ToLower().Trim());
                 f1_.Show();
                 this.Hide();
             }
         }
         else
         {
             MessageBoxButtons a       = MessageBoxButtons.OK;
             DialogResult      result4 = MessageBox.Show("The account is found, but the password is incorrect. Please fill your password properly", "Information Center", a, MessageBoxIcon.Information);
             if (result4 == DialogResult.OK)
             {
                 TB_Phone_LogIn.Clear();
                 TB_Password_LogIn.Clear();
                 TB_Phone_LogIn.Text = Phone_Temp;
             }
         }
     }
     catch (FileNotFoundException ex)
     {
         MessageBoxButtons a       = MessageBoxButtons.OK;
         DialogResult      result5 = MessageBox.Show("Account either not found or not registered yet. Please sign up your account first in order to use the application", "Information Center", a, MessageBoxIcon.Information);
         //label12.Text = ex.ToString();
     }
 }
Esempio n. 2
0
 public frmLogin()
 {
     InitializeComponent();
     TB_Nama_Reg.MaxLength       = 17;
     TB_Identitiy_Reg.MaxLength  = 17;
     TB_Phone_Reg.MaxLength      = 14;
     TB_Password_Reg.MaxLength   = 15;
     TB_Password_LogIn.MaxLength = 15;
     TB_Phone_LogIn.MaxLength    = 14;
     CB_Identity_Reg.Text        = "KTP";
     TB_Phone_LogIn.Focus();
 }