public void SaveFunction() { try { AccountLedgerInfo studentInfo = new AccountLedgerInfo(); StudentSP spStudent = new StudentSP(); for (int i = 0; i < dgvPromotion.RowCount; i++) { DataGridViewCheckBoxCell chkchecking = dgvPromotion.Rows[i].Cells["dgv_promoted"] as DataGridViewCheckBoxCell; if (dgvPromotion.Rows[i].Cells["dgvtxtStudentId"].Value.ToString() != string.Empty && dgvPromotion.Rows[i].Cells["dgvtxtStudentId"].Value != null) { studentInfo.LedgerId = Convert.ToInt32(dgvPromotion.Rows[i].Cells["dgvtxtStudentId"].Value.ToString()); } if (Convert.ToInt32(chkchecking.Value) >= 1) { spStudent.PromotedStudentAdd(studentInfo); Messages.SavedMessage(); } } } catch (Exception ex) { MessageBox.Show(" SaveFunction " + ex.Message); } }
/// <summary> /// Function to fill the values in curresponding controls for updation /// </summary> public void FillControls() { try { AccountLedgerInfo student = new AccountLedgerInfo(); StudentSP studentSP = new StudentSP(); student = studentSP.StudentView(studentId); if (student.Active) { cbxActive.Checked = true; } else { cbxActive.Checked = false; } txtFirstName.Text = student.LedgerName; txtLastName.Text = student.OtherName; txtDateOfBirth.Text = student.DateOfBirth.ToString("dd-MMM-yyyy"); txtPhone.Text = student.HomePhone; txtEmail.Text = student.Email; txtAdmision.Text = student.AdminNumber; cboLevel.SelectedValue = student.ClassNo; txtDateJoined.Text = student.DateJoined.ToString("dd-MMM-yyyy"); cboGender.SelectedItem = student.Gender; txtOpeningBalance.Text = Convert.ToString(student.OpeningBalance); cmbDrorCr.SelectedItem = student.CrOrDr; if (student.Photo != string.Empty && student.Photo != null) { photoPath = student.Photo; pictureBox.Image = Image.FromFile(photoPath); pictureBox.SizeMode = PictureBoxSizeMode.StretchImage; } else { pictureBox.Image = null; } txtGuardianName.Text = student.GuardianName; txtGuardianEmail.Text = student.GuardianEmail; txtRelatioship.Text = student.GuardianRelationship; txtGuardianPhone.Text = student.GuardianPhone; } catch (Exception ex) { MessageBox.Show("FillControlMthd " + ex.Message); } }
/// <summary> /// Function to fill dgvStudent based on txtSearch /// </summary> public void fill_update_transactions_grid() { StudentSP studSp = new StudentSP(); dgvStudent.AutoGenerateColumns = false; DataTable dt2 = new DataTable(); dt2 = studSp.get_student_details(Convert.ToString(txtSearch.Text)); dgvStudent.DataSource = dt2; }
/// <summary> /// Student Creation GridFill /// </summary> public void GridFill() { try { StudentSP spStudent = new StudentSP(); DataTable dtblStudentCreation = new DataTable(); dtblStudentCreation = spStudent.StudentCreationViewForGridFill(); dgvStudent.DataSource = dtblStudentCreation; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Student Creation GridFill /// </summary> public void GridFillSearch() { try { int search_item = Convert.ToInt32(cboSearch.SelectedValue.ToString()); StudentSP spStudent = new StudentSP(); DataTable dtblStudentCreation = new DataTable(); dtblStudentCreation = spStudent.StudentSearchViewForGridFill(search_item); dgvStudent.DataSource = dtblStudentCreation; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Student Creation GridFill /// </summary> public void GridFillSearch() { try { int search_item = Convert.ToInt32(cboClass.SelectedItem.ToString()); StudentSP spStudent = new StudentSP(); DataTable dtblStudentBalance = new DataTable(); dtblStudentBalance = spStudent.FillDatagridViewStudentBalance(search_item); dgvStudentBalance.DataSource = dtblStudentBalance; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void ComboSearchFill() { try { StudentSP stud = new StudentSP(); DataTable dt = new DataTable(); dt = stud.FillStudentClass(); cboSearch.DataSource = dt; cboSearch.ValueMember = "ClassNo"; cboSearch.DisplayMember = "ClassNo"; cboSearch.SelectedIndex = -1; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void ComboLevelFill() { try { StudentSP stud = new StudentSP(); DataTable dt = new DataTable(); dt = stud.FillDatagridViewPromotion(); cboClass.DataSource = dt; cboClass.ValueMember = "ClassNo"; cboClass.DisplayMember = "ClassNo"; cboClass.SelectedIndex = -1; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Student Creation GridFill /// </summary> public void GridFillSearch() { try { int search_item = Convert.ToInt32(cboClass.SelectedValue.ToString()); StudentSP spStudent = new StudentSP(); DataTable dtblStudentCreation = new DataTable(); dtblStudentCreation = spStudent.StudentPromotionViewForGridFill(search_item); dgvPromotion.DataSource = dtblStudentCreation; for (int i = 0; i < dgvPromotion.RowCount; i++) { dgvPromotion.Rows[i].Cells["dgv_promoted"].Value = true; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void SaveOrEdit() { try { if (cboLevel.SelectedIndex == -1) { MessageBox.Show("Select a class"); cboLevel.Focus(); } else if (txtFirstName.Text.Trim() == string.Empty) { MessageBox.Show("Enter FirstName"); txtFirstName.Focus(); } else if (txtLastName.Text.Trim() == string.Empty) { MessageBox.Show("Enter OtherName"); txtLastName.Focus(); } else if (txtAdmision.Text.Trim() == string.Empty) { MessageBox.Show("Enter Admission Number"); txtAdmision.Focus(); } else if (cboGender.SelectedIndex == -1) { MessageBox.Show("Select a Gender"); cboGender.Focus(); } else { AccountLedgerInfo student = new AccountLedgerInfo(); StudentSP studentSP = new StudentSP(); if (cbxActive.Checked) { student.Active = true; } else { student.Active = false; } student.AccountGroupId = 15; student.CrOrDr = cmbDrorCr.Text.Trim(); student.LedgerName = txtFirstName.Text.Trim(); student.OtherName = txtLastName.Text.Trim(); student.DateOfBirth = Convert.ToDateTime(txtDateOfBirth.Text.Trim()); student.OpeningBalance = txtOpeningBalance.Text.Trim() == string.Empty? balance : Convert.ToDecimal(txtOpeningBalance.Text.Trim()); student.HomePhone = txtPhone.Text.Trim(); student.Email = txtEmail.Text.Trim(); student.Gender = cboGender.SelectedItem.ToString(); student.AdminNumber = txtAdmision.Text.Trim(); student.ClassNo = Convert.ToInt32(cboLevel.SelectedValue.ToString()); student.DateJoined = Convert.ToDateTime(txtDateJoined.Text.Trim()); student.Photo = photoPath; student.GuardianName = txtGuardianName.Text.Trim(); student.GuardianEmail = txtGuardianEmail.Text.Trim(); student.GuardianRelationship = txtRelatioship.Text.Trim(); student.GuardianPhone = txtGuardianPhone.Text.Trim(); if (btnSave.Text == "Save") { if (Messages.SaveMessage()) { studentSP.StudentAdd(student); Messages.SavedMessage(); ClearFunction(); txtFirstName.Focus(); } } else { if (Messages.UpdateMessage()) { studentSP.StudentEdit(student, studentId); Messages.UpdatedMessage(); ClearFunction(); txtFirstName.Focus(); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnSave_Click(object sender, EventArgs e) { if (txbExcelPath.Text.Trim() == string.Empty) { MessageBox.Show("Browse for the excel path"); txbExcelPath.Focus(); } if (textSheetName.Text.Trim() == string.Empty) { MessageBox.Show("Enter Sheet Name"); textSheetName.Focus(); } else { AccountLedgerInfo student = new AccountLedgerInfo(); StudentSP studentSP = new StudentSP(); int rowcounter = dataGridView1.RowCount; try { for (int i = 0; i < rowcounter; i++) { if (dataGridView1.Rows[i].Cells["FirstName"].Value != null && dataGridView1.Rows[i].Cells["FirstName"].Value.ToString() != string.Empty) { student.LedgerName = Convert.ToString(dataGridView1.Rows[i].Cells["FirstName"].Value); } if (dataGridView1.Rows[i].Cells["LastName"].Value != null && dataGridView1.Rows[i].Cells["LastName"].Value.ToString() != string.Empty) { student.OtherName = Convert.ToString(dataGridView1.Rows[i].Cells["LastName"].Value); } if (dataGridView1.Rows[i].Cells["gender"].Value != null && dataGridView1.Rows[i].Cells["gender"].Value.ToString() != string.Empty) { student.Gender = Convert.ToString(dataGridView1.Rows[i].Cells["gender"].Value); } if (dataGridView1.Rows[i].Cells["dateOfBirth"].Value != null && dataGridView1.Rows[i].Cells["dateOfBirth"].Value.ToString() != string.Empty) { student.DateOfBirth = Convert.ToDateTime(dataGridView1.Rows[i].Cells["dateOfBirth"].Value.ToString()); } if (dataGridView1.Rows[i].Cells["AdminNumber"].Value != null && dataGridView1.Rows[i].Cells["AdminNumber"].Value.ToString() != string.Empty) { student.AdminNumber = Convert.ToString(dataGridView1.Rows[i].Cells["AdminNumber"].Value); } if (dataGridView1.Rows[i].Cells["Class"].Value != null && dataGridView1.Rows[i].Cells["Class"].Value.ToString() != string.Empty) { student.ClassNo = Convert.ToInt32(dataGridView1.Rows[i].Cells["Class"].Value.ToString()); } if (dataGridView1.Rows[i].Cells["AdmissionDate"].Value != null && dataGridView1.Rows[i].Cells["AdmissionDate"].Value.ToString() != string.Empty) { student.DateJoined = Convert.ToDateTime(dataGridView1.Rows[i].Cells["AdmissionDate"].Value); } student.AccountGroupId = 15; student.CrOrDr = "Cr"; studentSP.StudentAdd(student); } MessageBox.Show("Saved succesfully"); btnSave.Enabled = false; } catch (Exception ex) { MessageBox.Show(ex.Message); } } }