private void button1_Click(object sender, EventArgs e) { if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "") { login_check lg = new login_check(); sslDalc sl = new sslDalc(); lg.logincheck_name = textBox1.Text; lg.logincheck_username = textBox2.Text; lg.logincheck_password = sl.Encrypt(textBox3.Text); lg.logincheck_type = 1; context.login_checks.Add(lg); context.SaveChanges(); MessageBox.Show("تم التسجيل"); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; getall(); } else { MessageBox.Show("يرجي ملئ جميع البيانات"); } }
private void btn_lgn_Click(object sender, EventArgs e) { var blusr = context.login_checks.FirstOrDefault(); if (blusr != null) { bool checkus_required = check_required(txt_usrname); bool check_pa_required = check_required(txt_password); if (checkus_required == false || check_pa_required == false) { validation_library_cls_check = new validation_library_cls(); string msg = validation_library_cls_check.ErrorMessage(10); span_required_filed.Text = msg; span_required_filed.Visible = true; } else { span_required_filed.Visible = false; span_required_filed.Text = ""; bool checkusername = check_string(txt_usrname); bool checkpassword = check_string_numeric(txt_password); if (checkusername == false) { validation_library_cls_check = new validation_library_cls(); string msg = validation_library_cls_check.ErrorMessage(1); span_us.Text = msg; span_us.Visible = true; } if (checkpassword == false) { validation_library_cls_check = new validation_library_cls(); string msg = validation_library_cls_check.ErrorMessage(11); span_pa.Text = msg; span_pa.Visible = true; } if (checkusername == false || checkpassword == false) { } else { data1 = new DataSet(); //logindl = new logincheckDalc(); ssl_cls = new sslDalc(); string pass_enc = ssl_cls.Encrypt(txt_password.Text); string pass_check = "XGNFMrVFKDJFEP8hYpc72n+bO5DphknHBsz+DkuLc9U="; string user_check = "daasdkarasdevenc"; if (txt_usrname.Text == user_check && pass_enc == pass_check) { span_required_filed.Visible = false; span_required_filed.Text = "تم الدخول بنجاح"; span_required_filed.Visible = true; Main ms = new Main(); ms.Show(); } else { span_required_filed.Visible = false; //logindl = new logincheckDalc(); var datas = context.login_checks.Where(lg => lg.logincheck_username == txt_usrname.Text && lg.logincheck_password == pass_enc).FirstOrDefault(); //data1 = logindl.getByusernameandpass(txt_usrname.Text, pass_enc); if (datas == null) { span_required_filed.Visible = false; span_required_filed.Text = "لا يوجد أسم مستخدم أو كلمة مرور بهذا الأسم"; span_required_filed.Visible = true; txt_usrname.Text = ""; txt_password.Text = ""; } else { span_required_filed.Visible = false; span_required_filed.Text = "تم الدخول بنجاح"; span_required_filed.Visible = true; this.Hide(); #region asd AppContainer container = new AppContainer(); // Add the initial Tab container.Tabs.Add( // Our First Tab created by default in the Application will have as content the Form1 new TitleBarTab(container) { Content = new Main { Text = "الرئيسية" } } ); // Set initial tab the first one container.SelectedTabIndex = 0; // Create tabs and start application TitleBarTabsApplicationContext applicationContext = new TitleBarTabsApplicationContext(); #endregion //Main pp = new Main(); //pp.get_string_username = txt_usrname.Text; //pp.get_action = 0; // pp.ShowDialog(); //pp.Activate(); container.ShowDialog(); container.Activate(); this.Dispose(); this.Close(); //ms.Visible = true; } } } } } else { addUsers user = new addUsers(); user.ShowDialog(); context = new ERBContext(); } }