private void btnGenerate_Click(object sender, EventArgs e) { try { if (Validate_Controls()) { List <AdmissionFeeModel> listGridData = ConvertGridToList(); //Update Student ID listGridData.Select(x => { x.Student_ID = _studentID; return(x); }).ToList(); string Admission_Fee_XML = ConvertGridToXML(listGridData); AdmissionFee _admissionFee = new AdmissionFee(); short result = _admissionFee.Save_Admission_Fee(_studentID, Sequence_No_Student_Fee_Info, Admission_Fee_XML, (Int32)ddlAcademicYear.SelectedValue, Comma_Seprated_Months_Value(), Common.Convert_String_To_Date(txtMaskedDate.Text)); Get_Admission_Fee_Details_By_Student_ID(_studentID); if (result == 1) { MessageBox.Show("Record Successfully Saved.", "Admission Fee", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Error! Please contact to admin.", "Admission Fee", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception ex) { MessageBox.Show("Error! Please contact to admin.", "Admission Fee", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Get_Admission_Fee_Report() { try { AdmissionFee admissionFee = new AdmissionFee(); DataSet ds_Admission_Fee = admissionFee.Get_Admission_Fee_Report(_student_ID); if (ds_Admission_Fee != null && ds_Admission_Fee.Tables[0].Rows.Count > 0) { ds_Admission_Fee.Tables[0].TableName = "DT_Student"; ds_Admission_Fee.Tables[1].TableName = "DT_Admission_Fee"; ds_Admission_Fee.Tables[2].TableName = "DT_Student_Fee_Setting"; ds_Admission_Fee.Tables[3].TableName = "DT_School"; ReportDocument rdoc = new ReportDocument(); rdoc.Load(_appPath + "Reports\\Admission_Fee_Report.rpt"); rdoc.SetDataSource(ds_Admission_Fee); crystalReportViewer.ReportSource = rdoc; rdoc.Refresh(); crystalReportViewer.Refresh(); crystalReportViewer.Show(); crystalReportViewer.Visible = true; } } catch (Exception ex) { } }
public AdmissionFeeView() { InitializeComponent(); AdmissionFee data = new AdmissionFee(); admissionFee.ItemsSource = data.GetData(); DataContext = data; }
private void BindControls(long studentID, short monthValue, Int32 academicYear, string monthValuesDelimiterSeprated) { FeeType _feeType = new FeeType(); AdmissionFee _admissionFee = new AdmissionFee(); List <AdmissionFeeModel> _listAdmissionFee = _admissionFee.Get_Admission_Fee_List(studentID, monthValue, academicYear, monthValuesDelimiterSeprated); ConstructGrid(_listAdmissionFee.OrderBy(o => o.Fee_Type).ToList()); // ConstructGrid(_listAdmissionFee); }
private void Remove_Click(object sender, RoutedEventArgs e) { RemoveDialogView handle = new RemoveDialogView(); if (handle.ShowDialog() == true) { using (SqlConnection con = new SqlConnection(@Connection.ConnectionString)) { if (handle.FirstInput != handle.SecondInput) { MessageBox.Show("Entry No. did not match.Try again.\n", "Warning", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } Connection conn = new Connection(); conn.OpenConection(); int isLogin = 0; string query = "SELECT * From Stuff "; SqlDataReader reader = conn.DataReader(query); while (reader.Read()) { stuff_name = (string)reader["Stuff_Name"]; stuff_pass = (string)reader["Stuff_Password"]; if (stuff_name.Equals(Login.GlobalStuffName) && stuff_pass.Equals(handle.GetPassword)) { isLogin = 1; break; } } if (isLogin != 1) { MessageBox.Show("Wrong Password.Try again.\n", "Warning", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } using (SqlCommand command = new SqlCommand("DELETE FROM AdmissionFee WHERE Admission_Id = " + handle.FirstInput, con)) { con.Open(); command.ExecuteNonQuery(); con.Close(); } Id = Convert.ToInt32(handle.FirstInput); dateTime = DateTime.Today; string table = "AdmissionFee"; string type = "Removed"; string color = "Red"; EntryLog entry = new EntryLog(); entry.Add_Entry(table, type, Id, dateTime, color); conn.CloseConnection(); AdmissionFee data = new AdmissionFee(); admissionFee.ItemsSource = data.GetData(); DataContext = data; } } }
public void Search(string AdmissionNO) { bool ESchchecked = false; string E_scholarShip = null; DataTable dt = SPs.SpSearchStudentForclgFeeEnrollment(AdmissionNO, Convert.ToInt32(Session["BranchID"]), 2).GetDataSet().Tables[0]; if (dt.Rows.Count > 0) { if (!String.IsNullOrEmpty(dt.Rows[0]["Enrollement"].ToString())) { BasciInfo.Visible = true; lblStudentName.Text = dt.Rows[0]["StudentName"].ToString(); lblProgram.Text = dt.Rows[0]["Program"].ToString(); DataTable dtClgFee = helper.ExecutePlainQuery("select * from tbl_ClgFeeStructure where StudentID=" + dt.Rows[0]["StudentID"]); if (dtClgFee.Rows.Count > 0) { totalFee = Convert.ToInt32(dtClgFee.Rows[0]["PreviousTotalFee"]); AdmissionFee = Convert.ToInt32(dtClgFee.Rows[0]["AdmissionFee"]); Misc = Convert.ToInt32(dtClgFee.Rows[0]["Misc"]); TutionFee = Convert.ToInt32(dtClgFee.Rows[0]["TutionFee"]); txtAdvance.Text = dtClgFee.Rows[0]["Advance"].ToString(); txtDiscount.Text = dtClgFee.Rows[0]["Discount"].ToString(); btnSave.Text = "Update"; hfclgFeeID.Value = dtClgFee.Rows[0]["FeeID"].ToString(); GetScholarShip(ref ESchchecked, ref E_scholarShip, dtClgFee); } else { TblProgramFee obj = new TblProgramFee(TblProgramFee.Columns.Program, lblProgram.Text); if (!String.IsNullOrEmpty(obj.Program)) { totalFee = Convert.ToInt32(obj.TotalFee); AdmissionFee = Convert.ToInt32(obj.AdmissionFee); Misc = Convert.ToInt32(obj.Mise); TutionFee = Convert.ToInt32(obj.TuitionFee); } } lblTotalFee.Text = totalFee.ToString("#,##"); lblAdmissionFee.Text = AdmissionFee.ToString("#,##"); lblMisc.Text = Misc.ToString("#,##"); lblTutionFee.Text = TutionFee.ToString("#,##"); DataTable dtAc = helper.ExecutePlainQuery("SELECT * from TblStudentAcademicRecord where StudentID='" + dt.Rows[0]["StudentID"].ToString() + "' and ARecordID=(Select MAX(ARecordID) from TblStudentAcademicRecord where StudentID='" + dt.Rows[0]["StudentID"].ToString() + "')"); TotalMarks = Convert.ToInt32(dtAc.Rows[0]["totalmarks"]); ObtainedMarks = Convert.ToInt32(dtAc.Rows[0]["ObtainedMarks"]); lblAdmissionPlusMisc.Text = (AdmissionFee + Misc).ToString("#,##"); CalculateFee(); Percentage = Convert.ToInt32((ObtainedMarks / TotalMarks) * 100); lblpercentage.Text = Convert.ToString((ObtainedMarks / TotalMarks) * 100); if (lblpercentage.Text.Length > 4) { lblpercentage.Text = lblpercentage.Text.Substring(0, 4); } if (Percentage >= 85) { SectionScholarShips.Visible = false; SectionScholarShipsHeading.Visible = false; if (String.IsNullOrEmpty(hfclgFeeID.Value)) { txtTotal.Text = "Free"; } Highlight(trFree); } else if (Percentage >= 80 && Percentage <= 84) { SectionScholarShips.Visible = false; SectionScholarShipsHeading.Visible = false; if (String.IsNullOrEmpty(hfclgFeeID.Value)) { txtTotal.Text = Misc.ToString(); } Highlight(trMiscOnly); } else if (Percentage >= 75 && Percentage <= 79) { SectionScholarShips.Visible = false; SectionScholarShipsHeading.Visible = false; if (String.IsNullOrEmpty(hfclgFeeID.Value)) { txtTotal.Text = AdmissionFee.ToString(); } Highlight(trAdmssion); } else if (Percentage >= 70 && Percentage <= 74) { SectionScholarShips.Visible = false; SectionScholarShipsHeading.Visible = false; if (String.IsNullOrEmpty(hfclgFeeID.Value)) { txtTotal.Text = (AdmissionFee + Misc).ToString(); } Highlight(trAdmissionMisc); } else if (Percentage >= 65 && Percentage <= 69) { SectionScholarShips.Visible = true; SectionScholarShipsHeading.Visible = true; CalculateTutionFee = TutionFee * 80 / 100; TutionFee = TutionFee - CalculateTutionFee; if (String.IsNullOrEmpty(hfclgFeeID.Value)) { txtTotal.Text = (AdmissionFee + Misc + TutionFee).ToString(); } Highlight(tr80); } else if (Percentage >= 60 && Percentage <= 64) { SectionScholarShips.Visible = true; SectionScholarShipsHeading.Visible = true; CalculateTutionFee = TutionFee * 60 / 100; TutionFee = TutionFee - CalculateTutionFee; if (String.IsNullOrEmpty(hfclgFeeID.Value)) { txtTotal.Text = (AdmissionFee + Misc + TutionFee).ToString(); } Highlight(tr60); } else if (Percentage >= 55 && Percentage <= 59) { SectionScholarShips.Visible = true; SectionScholarShipsHeading.Visible = true; CalculateTutionFee = TutionFee * 40 / 100; TutionFee = TutionFee - CalculateTutionFee; if (String.IsNullOrEmpty(hfclgFeeID.Value)) { txtTotal.Text = (AdmissionFee + Misc + TutionFee).ToString(); } Highlight(tr40); } else if (Percentage >= 50 && Percentage <= 54) { SectionScholarShips.Visible = true; SectionScholarShipsHeading.Visible = true; CalculateTutionFee = TutionFee * 20 / 100; TutionFee = TutionFee - CalculateTutionFee; if (String.IsNullOrEmpty(hfclgFeeID.Value)) { txtTotal.Text = (AdmissionFee + Misc + TutionFee).ToString(); } Highlight(tr20); } tempTutionFee = TutionFee; } else { lblmsg.Text = helper.DisplayNotificationMessage(msgDiv, dt.Rows[0]["StudentName"] + " is not enrolled yet!", "alert alert-danger alert-icon alert-dismissible", icon, "icon mdi mdi-close-circle-o"); } } else { lblmsg.Text = helper.DisplayNotificationMessage(msgDiv, "No record found!", "alert alert-danger alert-icon alert-dismissible", icon, "icon mdi mdi-close-circle-o"); } }
private void Get_Admission_Fee_Details_By_Student_ID(long Student_ID) { AdmissionFee _admissionFee = new AdmissionFee(); Student_Admission_Fee_View_Model _model = _admissionFee.Get_Admission_Fee_Details_By_Student_ID(Student_ID); if (_model != null) { if (_model.List_Admission_Fee != null && _model.List_Admission_Fee.Count > 0) { ConstructGrid(_model.List_Admission_Fee); } if (_model.Student_Fee_Info != null) { if (_model.Student_Fee_Info.Academic_Year != null) { txtMaskedDate.Text = String.Format("{0:dd.MM.yyyy}", _model.Student_Fee_Info.Updated_Date); ddlAcademicYear.SelectedValue = _model.Student_Fee_Info.Academic_Year; } #region CheckBox Sequence_No_Student_Fee_Info = _model.Student_Fee_Info.Sequence_No; if (_model.Student_Fee_Info.April == 1) { chkApril.Checked = true; } else { chkApril.Checked = false; } if (_model.Student_Fee_Info.May == 1) { chkMay.Checked = true; } else { chkMay.Checked = false; } if (_model.Student_Fee_Info.June == 1) { chkJune.Checked = true; } else { chkJune.Checked = false; } if (_model.Student_Fee_Info.July == 1) { chkJuly.Checked = true; } else { chkJuly.Checked = false; } if (_model.Student_Fee_Info.August == 1) { chkAugust.Checked = true; } else { chkAugust.Checked = false; } if (_model.Student_Fee_Info.September == 1) { chkSeptember.Checked = true; } else { chkSeptember.Checked = false; } if (_model.Student_Fee_Info.October == 1) { chkOctober.Checked = true; } else { chkOctober.Checked = false; } if (_model.Student_Fee_Info.November == 1) { chkNovember.Checked = true; } else { chkNovember.Checked = false; } if (_model.Student_Fee_Info.December == 1) { chkDecember.Checked = true; } else { chkDecember.Checked = false; } if (_model.Student_Fee_Info.January == 1) { chkJanuary.Checked = true; } else { chkJanuary.Checked = false; } if (_model.Student_Fee_Info.February == 1) { chkFebruary.Checked = true; } else { chkFebruary.Checked = false; } if (_model.Student_Fee_Info.March == 1) { chkMarch.Checked = true; } else { chkMarch.Checked = false; } if (Sequence_No_Student_Fee_Info != null) { btnPrint.Enabled = true; } else { btnPrint.Enabled = false; } panelMonths.Enabled = true; BindMonths(Convert.ToInt32(ddlAcademicYear.SelectedValue)); #endregion } } }
protected void Save_Click(object sender, RoutedEventArgs e) { if (CheckForError(Collection)) { MessageBox.Show("Error!Check Input Again"); return; } double total = this.last_total(); if ((string)Save.Content == "Save") { using (SqlConnection conn = new SqlConnection(@Connection.ConnectionString)) { SqlCommand CmdSql = new SqlCommand("INSERT INTO [AdmissionFee] (Admission_Date, Admission_Collection, Admission_Total) VALUES (@Date, @Collection, @Total)", conn); conn.Open(); CmdSql.Parameters.AddWithValue("@Date", Date.SelectedDate); CmdSql.Parameters.AddWithValue("@Collection", Collection.Text); CmdSql.Parameters.AddWithValue("@Total", total + Convert.ToDouble(Collection.Text)); CmdSql.ExecuteNonQuery(); conn.Close(); //Inserting value in Entry table Connection conn2 = new Connection(); string query = "SELECT TOP 1 * FROM AdmissionFee ORDER BY Admission_Id DESC"; conn2.OpenConection(); SqlDataReader reader = conn2.DataReader(query); while (reader.Read()) { Id = (int)reader["Admission_Id"]; dateTime = (DateTime)reader["Admission_Date"]; } conn2.CloseConnection(); AdmissionFee data = new AdmissionFee(); admissionFee.ItemsSource = data.GetData(); DataContext = data; } string table = "Admission Fee"; string type = "Inserted"; string color = "Green"; EntryLog entry = new EntryLog(); entry.Add_Entry(table, type, Id, dateTime, color); MessageBox.Show("Successfully Inserted"); } else { int temp_id = Id; Connection conc = new Connection(); string query = "SELECT * FROM AdmissionFee Order by Admission_Id Asc"; conc.OpenConection(); SqlDataReader reader = conc.DataReader(query); while (reader.Read()) { string rid = reader["Admission_Id"].ToString(); int r_id = Convert.ToInt32(rid); string col = reader["Admission_Collection"].ToString(); int colint = Convert.ToInt32(col); if (temp_id < r_id) { Id = r_id; double tot = this.edited_total(); using (SqlConnection conn = new SqlConnection(@Connection.ConnectionString)) { SqlCommand CmdSql = new SqlCommand("UPDATE [AdmissionFee] SET Admission_Date = @Date , Admission_Collection = @Collection, Admission_Total = @Total WHERE Admission_Id=" + r_id, conn); conn.Open(); CmdSql.Parameters.AddWithValue("@Date", Date.SelectedDate); CmdSql.Parameters.AddWithValue("@Collection", col); CmdSql.Parameters.AddWithValue("@Total", (tot + colint)); CmdSql.ExecuteNonQuery(); conn.Close(); } Console.Write(r_id + " " + col + " " + tot + "..."); } else if (temp_id == r_id) { double tot = this.edited_total(); using (SqlConnection con = new SqlConnection(@Connection.ConnectionString)) { Console.Write(r_id + " " + col + " " + tot + "---"); SqlCommand CmdSql = new SqlCommand("UPDATE [AdmissionFee] SET Admission_Date = @Date , Admission_Total = @Total , Admission_Collection = @Collection WHERE Admission_Id=" + EntryNo.Text, con); con.Open(); CmdSql.Parameters.AddWithValue("@Date", Date.SelectedDate); CmdSql.Parameters.AddWithValue("@Collection", Collection.Text); CmdSql.Parameters.AddWithValue("@Total", tot + Convert.ToDouble(Collection.Text)); CmdSql.ExecuteNonQuery(); con.Close(); //Inserting value in Entry table Id = Convert.ToInt32(EntryNo.Text); dateTime = DateTime.Today; string table = "AdmissionFee"; string type = "Updated"; string color = "Blue"; EntryLog entry = new EntryLog(); entry.Add_Entry(table, type, Id, dateTime, color); Save.Content = "Save"; MessageBox.Show("Successfully Updated"); } } } conc.CloseConnection(); AdmissionFee data = new AdmissionFee(); admissionFee.ItemsSource = data.GetData(); DataContext = data; } }