private void SalaryCalculator_Load(object sender, EventArgs e) { for (int i = 0; i < User.salaryInfoList.Count(); i++) { if (User.salaryInfoList[i].Username == LoginedUser.getInstance().User.Username) { cBoxExperience.Text = User.salaryInfoList[i].Experience; cBoxProvince.Text = User.salaryInfoList[i].Province; cBoxEducation.Text = User.salaryInfoList[i].Education; cBoxForeignLanguage.Text = User.salaryInfoList[i].ForeignLanguage; cBoxManagement.Text = User.salaryInfoList[i].ManagmentTask; listBoxFamilyStatus.Text = User.salaryInfoList[i].FamilyStatus; } } btnCalculate.Visible = false; btnUpdate.Visible = false; if (cBoxExperience.Text == "" && cBoxProvince.Text == "" && cBoxEducation.Text == "" && cBoxForeignLanguage.Text == "" && cBoxManagement.Text == "" && listBoxFamilyStatus.Text == "") { btnCalculate.Visible = true; } else { btnUpdate.Visible = true; } }
private void backgroundProcess_DoWork(object sender, DoWorkEventArgs e) { string newPassword = GenerationRandomPassword(); SmtpClient sc = new SmtpClient(); sc.Port = 587; sc.Host = "smtp.gmail.com"; sc.EnableSsl = true; sc.Credentials = new NetworkCredential(LoginedUser.getInstance().User.Email, "apk12345"); // email gönderenin yani adminin maili ve sifresi MailMessage mail = new MailMessage(); mail.From = new MailAddress(LoginedUser.getInstance().User.Email); mail.To.Add(gridManagment.Rows[indexRow].Cells[3].Value.ToString()); // sifre gönderilecek yani herhangi bir kullanıcının maili, gridden secilenin. mail.Subject = "Reset Email"; mail.IsBodyHtml = true; mail.Body = newPassword; for (int i = 1; i <= 10; i++) { if (backgroundProcess.CancellationPending) { e.Cancel = true; backgroundProcess.ReportProgress(0); return; } else { Thread.Sleep(1000); backgroundProcess.ReportProgress(i * 10); } } sc.Send(mail); }
private void btnAdmin_Click_1(object sender, EventArgs e) { if (LoginedUser.getInstance().User.Usertype == "admin") { ManagementWindow newadmin = new ManagementWindow(); newadmin.Show(); this.Hide(); } }
private void Notes_Load(object sender, EventArgs e) { for (int i = 0; i < User.noteList.Count; i++) { if (User.noteList[i].Username == LoginedUser.getInstance().User.Username) { int index = gridNotes.Rows.Add(); gridNotes.Rows[index].Cells[0].Value = User.noteList[i].Title; gridNotes.Rows[index].Cells[1].Value = User.noteList[i].Message; } } }
private void PersonalOrganizer_Load(object sender, EventArgs e) { if (LoginedUser.getInstance().User.Usertype == "admin") { btnAdmin.Visible = true; pictureManagement.Visible = true; } else { btnAdmin.Visible = false; pictureManagement.Visible = false; } }
private void btnCreate_Click(object sender, EventArgs e) { string title = txtTitle.Text; string message = txtMessage.Text.Replace(Environment.NewLine, "\\\\n"); string username = LoginedUser.getInstance().User.Username; int index = gridNotes.Rows.Add(); gridNotes.Rows[index].Cells[0].Value = txtTitle.Text; gridNotes.Rows[index].Cells[1].Value = txtMessage.Text; User.noteList.Add(new ClassNotes(title, message, username)); Util.WriteNotes(User.noteList, @"notes.csv"); }
private void Reminder_Load(object sender, EventArgs e) { grpDetails.Visible = false; for (int i = 0; i < User.reminderList.Count; i++) { if (User.reminderList[i].Username == LoginedUser.getInstance().User.Username) { int index = gridReminder.Rows.Add(); gridReminder.Rows[index].Cells[0].Value = User.reminderList[i].Date; gridReminder.Rows[index].Cells[1].Value = User.reminderList[i].Instruction; gridReminder.Rows[index].Cells[2].Value = User.reminderList[i].Type; gridReminder.Rows[index].Cells[3].Value = User.reminderList[i].Time; } } }
private void btnSave_Click(object sender, EventArgs e) { string type = cmbBoxType.Text; string date = dateTimePicker.Text; string time = cmbBoxHour.Text + ":" + cmbBxMinute.Text; string instruction = txtInstruction.Text; string username = LoginedUser.getInstance().User.Username; User.reminderList.Add(new ClassReminder(instruction, date, time, type, username)); Util.WriteReminder(User.reminderList, @"reminder.csv"); this.Close(); Reminder reminder = new Reminder(); reminder.Show(); }
private void PhoneBook_Load(object sender, EventArgs e) { for (int i = 0; i < User.phonebookList.Count(); i++) { if ((User.phonebookList[i].Username == LoginedUser.getInstance().User.Username)) { int index = gridPhonebk.Rows.Add(); gridPhonebk.Rows[index].Cells[0].Value = User.phonebookList[i].Name; gridPhonebk.Rows[index].Cells[1].Value = User.phonebookList[i].Surname; gridPhonebk.Rows[index].Cells[2].Value = User.phonebookList[i].Phonenumber; gridPhonebk.Rows[index].Cells[3].Value = User.phonebookList[i].Email; gridPhonebk.Rows[index].Cells[4].Value = User.phonebookList[i].Address; gridPhonebk.Rows[index].Cells[5].Value = User.phonebookList[i].Description; } } }
private void btnUpdate_Click(object sender, EventArgs e) { for (int i = 0; i < User.salaryInfoList.Count(); i++) { if (User.salaryInfoList[i].Username == LoginedUser.getInstance().User.Username) { User.salaryInfoList[i].Experience = cBoxExperience.Text; User.salaryInfoList[i].Province = cBoxProvince.Text; User.salaryInfoList[i].Education = cBoxEducation.Text; User.salaryInfoList[i].ForeignLanguage = cBoxForeignLanguage.Text; User.salaryInfoList[i].ManagmentTask = cBoxManagement.Text; User.salaryInfoList[i].FamilyStatus = listBoxFamilyStatus.Text; User.salaryInfoList[i].Username = LoginedUser.getInstance().User.Username; Util.WriteSalary(User.salaryInfoList, @"salaryInfo.csv"); } } calculateSalary(); }
private void CreateBttn_Click(object sender, EventArgs e) { string phonenumber = PhoneNumBox.Text; string name = NameBox.Text; string surname = SurnameBox.Text; string email = MailBox.Text; string address = AddressBox.Text; string description = DescriptionBox.Text; string username = LoginedUser.getInstance().User.Username; int index = gridPhonebk.Rows.Add(); gridPhonebk.Rows[index].Cells[0].Value = name; gridPhonebk.Rows[index].Cells[1].Value = surname; gridPhonebk.Rows[index].Cells[2].Value = phonenumber; gridPhonebk.Rows[index].Cells[3].Value = email; gridPhonebk.Rows[index].Cells[4].Value = address; gridPhonebk.Rows[index].Cells[5].Value = description; User.phonebookList.Add(new ClassPhonebook(name, surname, phonenumber, email, address, description, username)); Util.WritePhonebook(User.phonebookList, @"phone.csv"); }
private void LoginBtn_Click(object sender, EventArgs e) { username = usernameBox.Text; password = passwordBox.Text; infolabel.Visible = true; if (remembercheckBox.Checked == true) { Properties.Settings.Default.username = usernameBox.Text; Properties.Settings.Default.password = passwordBox.Text; Properties.Settings.Default.Save(); } if (remembercheckBox.Checked == false) { Properties.Settings.Default.username = ""; Properties.Settings.Default.password = ""; Properties.Settings.Default.Save(); } for (int i = 0; i < User.userlist.Count(); i++) { User user_data = User.userlist[i]; if (user_data.IsValid(username, password)) { LoginedUser.getInstance().User = user_data; infolabel.ForeColor = Color.Green; infolabel.Text = "Correct."; remembercheckBox.Checked = false; EntryTime.Enabled = true; return; } infolabel.ForeColor = Color.Red; infolabel.Text = "Not Correct.If you are not a member, please register first."; } usernameBox.Clear(); passwordBox.Clear(); }
private void DeleteBttn_Click(object sender, EventArgs e) { for (int i = 0; i < User.phonebookList.Count(); i++) { if ((gridPhonebk.Rows[indexRow].Cells[0].Value == User.phonebookList[i].Name) && (gridPhonebk.Rows[indexRow].Cells[1].Value == User.phonebookList[i].Surname) && (gridPhonebk.Rows[indexRow].Cells[2].Value == User.phonebookList[i].Phonenumber) && (gridPhonebk.Rows[indexRow].Cells[3].Value == User.phonebookList[i].Email) && (gridPhonebk.Rows[indexRow].Cells[4].Value == User.phonebookList[i].Address) && (gridPhonebk.Rows[indexRow].Cells[5].Value == User.phonebookList[i].Description) && (User.phonebookList[i].Username == LoginedUser.getInstance().User.Username)) { gridPhonebk.Rows.RemoveAt(indexRow); User.phonebookList.Remove(User.phonebookList[i]); Util.WritePhonebook(User.phonebookList, @"phone.csv"); } } if (gridPhonebk.CurrentRow.Cells[0].Value != null) { gridPhonebk.Rows.RemoveAt(gridPhonebk.CurrentRow.Index); } else { MessageBox.Show("Please select the line to be deleted."); } }
private void UpdateBttn_Click(object sender, EventArgs e) { for (int i = 0; i < User.phonebookList.Count(); i++) { if ((gridPhonebk.Rows[indexRow].Cells[0].Value == User.phonebookList[i].Name) && (gridPhonebk.Rows[indexRow].Cells[1].Value == User.phonebookList[i].Surname) && (gridPhonebk.Rows[indexRow].Cells[2].Value == User.phonebookList[i].Phonenumber) && (gridPhonebk.Rows[indexRow].Cells[3].Value == User.phonebookList[i].Email) && (gridPhonebk.Rows[indexRow].Cells[4].Value == User.phonebookList[i].Address) && (gridPhonebk.Rows[indexRow].Cells[5].Value == User.phonebookList[i].Description) && (User.phonebookList[i].Username == LoginedUser.getInstance().User.Username)) { gridPhonebk.Rows[indexRow].Cells[0].Value = User.phonebookList[i].Name = NameBox.Text; gridPhonebk.Rows[indexRow].Cells[1].Value = User.phonebookList[i].Surname = SurnameBox.Text; gridPhonebk.Rows[indexRow].Cells[2].Value = User.phonebookList[i].Phonenumber = PhoneNumBox.Text; gridPhonebk.Rows[indexRow].Cells[3].Value = User.phonebookList[i].Email = MailBox.Text; gridPhonebk.Rows[indexRow].Cells[4].Value = User.phonebookList[i].Address = AddressBox.Text; gridPhonebk.Rows[indexRow].Cells[5].Value = User.phonebookList[i].Description = DescriptionBox.Text; Util.WritePhonebook(User.phonebookList, @"phone.csv"); } } }
private void btnCalculate_Click(object sender, EventArgs e) { User.salaryInfoList.Add(new ClassSalaryCalc(cBoxExperience.Text, cBoxProvince.Text, cBoxEducation.Text, cBoxForeignLanguage.Text, cBoxManagement.Text, listBoxFamilyStatus.Text, LoginedUser.getInstance().User.Username)); Util.WriteSalary(User.salaryInfoList, @"salaryInfo.csv"); calculateSalary(); }