private void frmStudent_Load(object sender, EventArgs e) { Student s = new Student(); s.StudentID = std_id_sarasari; DataTable dt = s.search(); if (dt.Rows[0]["gender"].ToString() == "زن") { this.Text = " خوش آمدید خانم " + dt.Rows[0]["firstName"].ToString() + " " + dt.Rows[0]["lastName"].ToString(); } else { this.Text = "خوش آمدید آقای " + dt.Rows[0]["firstName"].ToString() + " " + dt.Rows[0]["lastName"].ToString(); } }
private void t5btnReturn_Click(object sender, EventArgs e) { int tkd = 6, tkm = -1; //code for tkd Student s = new Student(); s.StudentID = t5txtReturntStudentID.Text; DataTable dts = s.search(); if (dts.Rows.Count == 0) { MessageBox.Show("چنین دانشجویی نداریم"); } else { tkd = Convert.ToInt32(dts.Rows[0]["borrowedBookQty"].ToString()); } //code for tkm Book b = new Book(); b.BookCategorizationNo = t5txtReturnCategorizationNo.Text; DataTable dtb = b.search(); if (dtb.Rows.Count == 0) { MessageBox.Show("چنین کتابی نداریم"); } else { tkm = Convert.ToInt32(dtb.Rows[0]["bookQty"].ToString()); } if (tkd == 0) { MessageBox.Show("این دانشجو کتابی در دست امانت ندارد"); } if ((dts.Rows.Count != 0) && (dtb.Rows.Count != 0) && (tkd != 0)) { Borrow borrow = new Borrow(); borrow.StudentID = t5txtReturntStudentID.Text; borrow.BookCategorizationNo = t5txtReturnCategorizationNo.Text; borrow.ReturnDate = t5txtReturnYear.Text + "/" + t5txtReturnMonth.Text + "/" + t5txtReturnDay.Text; borrow.updateBorrow(); tkm++; tkd--; s.BorrowedBookQty = Convert.ToString(tkd); s.edit_std_amanat(); b.BookQty = Convert.ToString(tkm); b.edit_book_amanat(); } t5txtReturntStudentID.Text = ""; t5txtReturnCategorizationNo.Text = ""; t5txtReturnYear.Text = ""; t5txtReturnMonth.Text = ""; t5txtReturnDay.Text = ""; }
private void t5btnBorrow_Click(object sender, EventArgs e) { int tkd = 6, tkm = -1; //code for tkd Student s = new Student(); s.StudentID = t5txtBorrowtStudentID.Text; DataTable dts = s.search(); if (dts.Rows.Count == 0) { MessageBox.Show("چنین دانشجویی نداریم"); } else { tkd = Convert.ToInt32(dts.Rows[0]["borrowedBookQty"].ToString()); } //code for tkm Book b = new Book(); b.BookCategorizationNo = t5txtBorrowCategorizationNo.Text; DataTable dtb = b.search(); if (dtb.Rows.Count == 0) { MessageBox.Show("چنین کتابی نداریم"); } else { tkm = Convert.ToInt32(dtb.Rows[0]["bookQty"].ToString()); } if (tkd < 5 && tkm > 0) { Borrow borrow = new Borrow(); borrow.StudentID = t5txtBorrowtStudentID.Text; borrow.BookCategorizationNo = t5txtBorrowCategorizationNo.Text; borrow.BorrowDate = t5txtBorrowYear.Text + "/" + t5txtBorrowMonth.Text + "/" + t5txtBorrowDay.Text; borrow.insertBorrow(); tkm--; tkd++; s.BorrowedBookQty = Convert.ToString(tkd); s.edit_std_amanat(); b.BookQty = Convert.ToString(tkm); b.edit_book_amanat(); } else if (tkd == 5) { MessageBox.Show("دانشجوی گرامی شما حداکثر5 کتاب می توانید به امانت داشته باشید. لطفا یکی از آن ها را بازگردانید"); } else if (tkm == 0) { MessageBox.Show("کتاب به امانت دیگری است. لطفا رزرو کنید"); } t5txtBorrowtStudentID.Text = ""; t5txtBorrowCategorizationNo.Text = ""; t5txtBorrowYear.Text = ""; t5txtBorrowMonth.Text = ""; t5txtBorrowDay.Text = ""; }
private void t1btnRegister_Click(object sender, EventArgs e) { Student s = new Student(); s.StudentID = t1txtStudentID.Text; s.FirstName = t1txtFirstName.Text; s.LastName = t1txtLastName.Text; s.Field = t1cbField.Text; s.Section = t1cbSection.Text; s.Inning = t1cbInning.Text; s.MobileNo = t1txtMobileNo.Text; s.PhoneNo = t1txtPhoneNo.Text; s.Email = t1txtEmail.Text; if (t1rbFemale.Checked == true) { s.Gender = "زن"; } else if (t1rbMale.Checked == true) { s.Gender = "مرد"; } if (t1rbSingle.Checked == true) { s.MaritalStatus = "مجرد"; } else if (t1rbMarried.Checked == true) { s.MaritalStatus = "متاهل"; } s.BirthdayDate = t1txtBirthYear.Text + "/" + t1txtBirthMonth.Text + "/" + t1txtBirthDay.Text; s.EducationStartDate = t1txtStartEducationYear.Text + "/" + t1txtStartEducationMonth.Text + "/" + t1txtStartEducationDay.Text; s.EducationEndDate = t1txtEndEducationYear.Text + "/" + t1txtEndEducationMonth.Text + "/" + t1txtEndEducationDay.Text; s.BorrowedBookQty = "0"; //s.insertStudent(); DataTable dt = s.search(); if (dt.Rows.Count == 0) { s.insertStudent(); } else { MessageBox.Show("این دانشجو قبلا ثبت نام شده است."); } //خالی شدن آیتم ها پس از زدن دکمه ثبت نام t1txtStudentID.Text = ""; t1txtFirstName.Text = ""; t1txtLastName.Text = ""; t1cbField.Text = ""; t1cbSection.Text = ""; t1cbInning.Text = ""; t1txtMobileNo.Text = ""; t1txtPhoneNo.Text = ""; t1txtEmail.Text = ""; t1rbFemale.Checked = false; t1rbMale.Checked = false; t1rbSingle.Checked = false; t1rbMarried.Checked = false; t1txtBirthYear.Text = ""; t1txtBirthMonth.Text = ""; t1txtBirthDay.Text = ""; t1txtStartEducationYear.Text = ""; t1txtStartEducationMonth.Text = ""; t1txtStartEducationDay.Text = ""; t1txtEndEducationYear.Text = ""; t1txtEndEducationMonth.Text = ""; t1txtEndEducationDay.Text = ""; }
private void t2btnSearch_Click(object sender, EventArgs e) { Student s = new Student(); s.StudentID = head_t2txtStudentID.Text; DataTable dt = s.search(); if (dt.Rows.Count == 0) { MessageBox.Show("این دانشجو قبلا ثبت نام نشده است."); } else { t2panel.Enabled = true; t2txtFirstName.Text = dt.Rows[0]["firstName"].ToString(); t2txtLastName.Text = dt.Rows[0]["lastName"].ToString(); t2cbField.Text = dt.Rows[0]["field"].ToString(); t2cbSection.Text = dt.Rows[0]["section"].ToString(); t2cbInning.Text = dt.Rows[0]["inning"].ToString(); t2txtMobileNo.Text = dt.Rows[0]["mobileNo"].ToString(); t2txtPhoneNo.Text = dt.Rows[0]["phoneNo"].ToString(); t2txtEmail.Text = dt.Rows[0]["email"].ToString(); t2txtBorrowedBook.Text = dt.Rows[0]["borrowedBookQty"].ToString(); if (dt.Rows[0]["gender"].ToString() == "زن") { t2rbFemale.Checked = true; } else if (dt.Rows[0]["gender"].ToString() == "مرد") { t2rbMale.Checked = true; } if (dt.Rows[0]["maritalStatus"].ToString() == "مجرد") { t2rbSingle.Checked = true; } else if (dt.Rows[0]["maritalStatus"].ToString() == "متاهل") { t2rbMarried.Checked = true; } string[] bd = dt.Rows[0]["birthdayDate"].ToString().Split('/'); t2txtBirthYear.Text = bd[0]; t2txtBirthMonth.Text = bd[1]; t2txtBirthDay.Text = bd[2]; string[] esd = dt.Rows[0]["educationStartDate"].ToString().Split('/'); t2txtStartEducationYear.Text = esd[0]; t2txtStartEducationMonth.Text = esd[1]; t2txtStartEducationDay.Text = esd[2]; string[] eed = dt.Rows[0]["educationEndDate"].ToString().Split('/'); t2txtEndEducationYear.Text = eed[0]; t2txtEndEducationMonth.Text = eed[1]; t2txtEndEducationDay.Text = eed[2]; } }