private void frm_server_Load(object sender, EventArgs e) { IniFile ini = new IniFile(Tool.confg); txt_Server.Text = ini.IniReadValue("SERVER", "SERVER"); txt_database.Text = ini.IniReadValue("SERVER", "Database"); txt_userID.Text = ini.IniReadValue("SERVER", "UID"); txt_Password.Text = EncodeString.Decrypt(ini.IniReadValue("SERVER", "Pwd")); }
private void cmd_login_Click(object sender, EventArgs e) { try { DataClasses1DataContext db = new DataClasses1DataContext(Tool.ConnectionString); this.Text = "Connecting to database"; var list = db.sp_login(txt_username.Text, EncodeString.Encrypt(txt_password.Text)).ToList(); if (list.Count >= 1) { foreach (var i in list) { fmain.fullname = i.fullname; fmain.lbl_current_username.Text = i.fullname; fmain.UserLevel = i.Level_cn.ToString(); fmain.UserCn = i.cn.ToString(); } //if (fmain.UserLevel != "3") //{ db.sp_insertLog__("Login", fmain.fullname, "Login"); fmain.Text = Tool.Systemname; fmain.buttonSelectection(fmain.pb1); fmain.DailyTimeRecordSELECT(); fmain.Show(); //} fmain.isLogin = true; this.Close(); } else { txt_username.Clear(); txt_password.Clear(); MessageBox.Show("User does not exist", "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } catch (Exception ex) { MessageBox.Show(this, string.Format("An error occured {0}", ex.Message), "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); new frm_server().ShowDialog(); } }
private void button1_Click(object sender, EventArgs e) { try { IniFile ini = new IniFile(Tool.confg); ini.IniWriteValue("SERVER", "Server", txt_Server.Text); ini.IniWriteValue("SERVER", "Database", txt_database.Text); ini.IniWriteValue("SERVER", "UID", txt_userID.Text); ini.IniWriteValue("SERVER", "Pwd", EncodeString.Encrypt(txt_Password.Text)); Tool.ConnectionString = "Data Source=" + ini.IniReadValue("SERVER", "Server") + ";Initial Catalog=" + ini.IniReadValue("SERVER", "Database") + ";Persist Security Info=True;User ID=" + ini.IniReadValue("SERVER", "UID") + ";Password="******"SERVER", "Pwd") + ";"; Application.Restart(); } catch (Exception ex) { MessageBox.Show(this, string.Format("An error occured {0}", ex.Message), "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } }
private void cb_show_pwd_CheckedChanged(object sender, EventArgs e) { try { if (cb_show_pwd.Checked) { // e_password = txt_password.Text; txt_password.UseSystemPasswordChar = false; //txt_password.Text = EncodeString.Decrypt(txt_password.Text); } else { txt_password.UseSystemPasswordChar = true; // txt_password.Text = EncodeString.Encrypt(txt_password.Text); } } catch { txt_password.Text = EncodeString.Decrypt(e_password); } }
private void button5_Click(object sender, EventArgs e) { Console.Write(EncodeString.Encrypt("Sommerson26")); }
public void getDetails(string cn) { rbStudent.Visible = false; rbUser.Visible = false; DataClasses1DataContext db = new DataClasses1DataContext(Tool.ConnectionString); var i = db.AccountSelectByID(this.Tag.ToString()).FirstOrDefault(); if (!i.Level_cn.Equals(3)) { wizard1.SelectedTab = tabPage3; txt_fname.Text = i.Firstname; txt_MName.Text = i.Middlename; txt_Lname.Text = i.Lastname; txt_username.Text = i.Email; cbo_level.Tag = i.Level_cn; txt_username.Text = i.Email; try { DateTime Bd = i.BirrthDate.Value; dtBirthDate.Text = Bd.ToShortDateString(); } catch (Exception ex) { Console.WriteLine(ex.Message); } txtSy.Text = i.SchoolYear; txtStrand.Text = i.Strand; txtGuardiansName.Text = i.GuardianName; txt_password.Text = EncodeString.Decrypt(i.Password); try { pbUser.Image = Tool.bytetoimage(i.AVATAR.ToArray()); } catch (Exception) { pbUser.Image = Properties.Resources.AnonymousPic; } try { FingerPrintScanner.FingerprintTemplate = i.biometrics.ToArray(); } catch (Exception) { } } else { wizard1.SelectedTab = tabPage4; FirstNameStudent.Text = i.Firstname; MiddleNameStudent.Text = i.Middlename; LastNameStudent.Text = i.Lastname; LRNStudent.Text = i.LRN; txtQrCode.Text = i.RFID; cboGrade.Text = i.GradeName; cboSection.Text = i.Section_; cboCourse.Text = i.CourseName; txtSectionOther.Text = i.SectionOther; txtGradeOther.Text = i.GradeName; PhoneNumberStudent.Text = i.PhoneNo; txtGuardiansName.Text = i.GuardianName; string schedule = i.Schedule; string[] scheduleSplited = schedule.Split('/'); dt_TimeIN.Text = scheduleSplited[0]; dt_TimeOUT.Text = scheduleSplited[1]; txtAdviser.Text = i.Adviser; try { pbStudent.Image = Tool.bytetoimage(i.AVATAR.ToArray()); } catch (Exception) { pbStudent.Image = Properties.Resources.AnonymousPic; } try { FingerPrintScanner.FingerprintTemplate = i.biometrics.ToArray(); } catch (Exception) { } } }
private void Main_Load(object sender, EventArgs e) { try { IniFile ini = new IniFile(Tool.confg); Tool.ConnectionString = "Data Source=" + ini.IniReadValue("SERVER", "Server") + ";Initial Catalog=" + ini.IniReadValue("SERVER", "Database") + ";Persist Security Info=True;User ID=" + ini.IniReadValue("SERVER", "UID") + ";Password="******"SERVER", "Pwd")) + ";"; if (!File.Exists(Tool.confg)) { ini.IniWriteValue("SYSTEM", "Name", "Change System name in config.ini"); ini.IniWriteValue("LOCATION", "Address", ""); } Tool.Systemname = ini.IniReadValue("SYSTEM", "Name"); lbl_system_name.Text = Tool.Systemname; this.Hide(); new frm_login(this).ShowDialog(); } catch (Exception) { new frm_server().ShowDialog(); throw; } }