public void loadDataGridView() { dt_student = Student_Methods.loadStudent(); Student_Detail_dataGridView.DataSource = null; Student_Detail_dataGridView.DataSource = dt_student; Student_Detail_dataGridView.Columns["Profile"].Visible = false; }
private void update_button_Click(object sender, EventArgs e) { if (Student_Detail_dataGridView.Rows.Count > 0) { int selectedRow = Student_Detail_dataGridView.Rows.GetFirstRow(DataGridViewElementStates.Selected); int Grno = Convert.ToInt32(Student_Detail_dataGridView.Rows[selectedRow].Cells["Grno"].Value); DataTable dt = Student_Methods.loadStudentDetails_Form(Grno); studadd = new StudentAdmission(LoadUpdateForm(dt), this); if (update_button.Text.Equals("View Student Details", StringComparison.OrdinalIgnoreCase)) { studadd.isReadOnly = true; } studadd.isUpdate = true; studadd.TopLevel = false; studadd.Parent = ClassCall.mainFormObj.masterpanel; studadd.Dock = DockStyle.Fill; studadd.BringToFront(); studadd.Focus(); studadd.Show(); this.Dispose(); } }
private void loadState() { dt_state = Student_Methods.loadState(); state_comboBox.DisplayMember = "StateNm"; state_comboBox.ValueMember = "StateId"; state_comboBox.DataSource = dt_state; }
private void remove_button_Click(object sender, EventArgs e) { if (Student_Detail_dataGridView.Rows.Count > 0) { int selectedRow = Student_Detail_dataGridView.Rows.GetFirstRow(DataGridViewElementStates.Selected); int Grno = Convert.ToInt32(Student_Detail_dataGridView.Rows[selectedRow].Cells["Grno"].Value); string imagePath = Student_Detail_dataGridView.Rows[selectedRow].Cells["Profile"].Value.ToString(); int affectedRows = Student_Methods.deleteStudent(Grno); if (affectedRows > 0) { if (!(imagePath.Equals("System.Drawing.Bitmap", StringComparison.OrdinalIgnoreCase) || string.IsNullOrEmpty(imagePath))) { System.GC.Collect(); System.GC.WaitForPendingFinalizers(); if (System.IO.File.Exists(imagePath)) { System.IO.File.Delete(imagePath); } } AlertBox.ShowDialog("Successfully deleted", AlertBox.AlertType.success, true); select_course_comboBox.SelectedIndex = 0; student_detail_textBox.Clear(); loadDataGridView(); } } }
private void loadCity() { dt_city = Student_Methods.loadCity(); city_comboBox.DisplayMember = "CityNm"; city_comboBox.ValueMember = "CityId"; city_comboBox.DataSource = dt_city; }
private void loadCourse() { dt_course = Student_Methods.loadCourse(); admission_stream_combobox.DataSource = dt_course; admission_stream_combobox.ValueMember = "C_Id"; admission_stream_combobox.DisplayMember = "C_Alias"; }
private void loadCast() { DataTable dt_cast = Student_Methods.loadCast(); cast_comboBox.DisplayMember = "CastNm"; cast_comboBox.ValueMember = "CastId"; cast_comboBox.DataSource = dt_cast; }
private void loadCountry() { DataTable dt_country = Student_Methods.loadCountry(); nationality_comboBox.DisplayMember = "CountryNm"; nationality_comboBox.ValueMember = "CountryId"; nationality_comboBox.DataSource = dt_country; }
private void loadCountry() { DataTable dt = Student_Methods.loadCountry(); country_comboBox.DisplayMember = "CountryNm"; country_comboBox.ValueMember = "CountryId"; country_comboBox.DataSource = dt; }
private void loadGrno() { int grno = Student_Methods.loadGrno(); grno_textBox.Text = grno.ToString(); }
private void save_button_Click(object sender, EventArgs e) { if (!isPersonalDet_Validated) { AlertBox.ShowDialog("Please fill up Personal Detail", AlertBox.AlertType.error, false); studentadmission_tabControl.SelectedIndex = 0; } else if (educational_details_validation() /* && isPersonalDet_Validated*/) { #region entity StudentEntity se = new StudentEntity(); se.grno = int.Parse(grno_textBox.Text); se.AdmissionDate = admission_dateTimePicker.Value; se.ProfilePhoto = ImagePath; se.candidate_FirstName = candidatefnm_TextBox.Text; se.candidate_MiddleName = candidatemnm_TextBox.Text; se.candidate_LastName = candidatelnm_TextBox.Text; se.gender = (male_radioButton.Checked) ? male_radioButton.Text : female_radioButton.Text; se.CastId = int.Parse(cast_comboBox.SelectedValue.ToString()); se.CountryId = int.Parse(country_comboBox.SelectedValue.ToString()); se.StateId = int.Parse(state_comboBox.SelectedValue.ToString()); se.CityId = int.Parse(city_comboBox.SelectedValue.ToString()); se.CurrentAddress = currentaddress_textbox.Text; se.PermanentAddress = permanentaddress_textbox.Text; se.Pincode = (pincode_TextBox.Text == string.Empty) ? (int?)null : int.Parse(pincode_TextBox.Text); se.BirthPlace = birthplace_TextBox.Text; se.DOB = dob_dateTimePicker.Value; se.MobileNo = Int64.Parse(candidate_mno_textbox.Text); se.TelephoneNo = (telephone_textbox.Text == string.Empty) ? (Int64?)null : Int64.Parse(telephone_textbox.Text); se.Email = email_textbox.Text; se.CourseId = int.Parse(admission_stream_combobox.SelectedValue.ToString()); se.Coursenm = admission_stream_combobox.Text; se.AdmissionSem = int.Parse(admission_sem_numericUpDown.Value.ToString()); se.CurrentSem = int.Parse(admission_sem_numericUpDown.Value.ToString()); se.Discount = int.Parse(discount_numericUpDown.Value.ToString()); se.Fees = int.Parse(fees_to_pay_textbox.Text); se.Remark = remark_textBox.Text; se.CurrentStatus = 'C'; if (Convert.ToInt32(admission_sem_numericUpDown.Maximum) > 1) { se.LeavingYear = admission_dateTimePicker.Value.Year + Convert.ToInt32(admission_sem_numericUpDown.Maximum / 2); } else { int Mymonth = 0; if ((admission_dateTimePicker.Value.Month + 6) > 12) { int InCurrentYear = 12 - admission_dateTimePicker.Value.Month; int InNextYear = 6 - InCurrentYear; Mymonth = InNextYear; } else { Mymonth = admission_dateTimePicker.Value.Month + 6; } DateTime dt = new DateTime(admission_dateTimePicker.Value.Year, Mymonth, admission_dateTimePicker.Value.Day); se.LeavingYear = dt.Year; } se.father_FirstName = fatherfnm_TextBox.Text; se.father_MiddleName = fathermnm_TextBox.Text; se.father_LastName = fatherlnm_TextBox.Text; se.mother_FirstName = motherfnm_TextBox.Text; se.mother_MiddleName = mothermnm_TextBox.Text; se.mother_LastName = motherlnm_TextBox.Text; se.ParentsOccupation = father_mother_occupation_textbox.Text; se.OfficeAddress = office_address_textBox.Text; se.ContactNo = Int64.Parse(parents_contact_TextBox.Text); se.SchoolName = schoolnm_textbox.Text; se.SchoolStream = school_stream_textbox.Text; se.LastYear = int.Parse(school_year_textbox.Text); se.LastYear_Percentage = int.Parse(school_percent_textbox.Text); se.marksheet_12 = school_marksheet_CheckBox.Checked; se.lc_12 = school_LC_checkBox.Checked; se.TC = college_tc_checkBox.Checked; se.previous_marksheet = college_previous_marksheet_checkBox.Checked; se.NOC = college_NOC_checkBox.Checked; if (college_checkBox.Checked) { se.checkCollege = true; se.CollegeName = collegenm_textbox.Text; se.CollegeStream = college_stream_textbox.Text; se.CollegeYear = int.Parse(college_year_textbox.Text); se.LastSem = int.Parse(college_last_sem_numericUpDown.Value.ToString()); se.LastSem_Percentage = int.Parse(college_percent_textbox.Text); } #endregion if (this.isUpdate) { Student_Methods.deleteStudent_for_Update(int.Parse(grno_textBox.Text)); } if (Student_Methods.insertStudent(se) > 0) { if (isStore) { File.Copy(openphoto.FileName, ImagePath, true); if (this.isUpdate) { student_pictureBox.Enabled = false; } } if (!isUpdate) { AlertBox.ShowDialog("Successfull registered", AlertBox.AlertType.success, true); clearAll(sender, e); loadGrno(); admission_stream_combobox_SelectedIndexChanged(sender, e); } else { AlertBox.ShowDialog("Successfully updated", AlertBox.AlertType.success, true); DataTable dt_student = Student_Methods.loadStudent(); } studentadmission_tabControl.SelectedIndex = 0; } } }