public ModelStudentFee GetStudentSinngleFeeInfoByFeeId(double FeeId) { ModelStudentFee objModelStudentFee = new ModelStudentFee(); DataTable tblStudentFeeInfo = new DataTable(); SqlParameter[] param = new SqlParameter[1]; param[0] = new SqlParameter("@FeeId", FeeId); tblStudentFeeInfo = DALCommon.GetDataUsingDataTable("[sp_Admin_GetStudentSinngleFeeInfoByFeeId]", param); if (tblStudentFeeInfo.Rows.Count > 0) { objModelStudentFee.FeeId = Convert.ToDouble(tblStudentFeeInfo.Rows[0]["FeeId"]); objModelStudentFee.StudentId = Convert.ToInt32(tblStudentFeeInfo.Rows[0]["StudentId"]); objModelStudentFee.ComputerCode = Convert.ToInt32(tblStudentFeeInfo.Rows[0]["ComputerCode"]); objModelStudentFee.SerialNo = Convert.ToInt32(tblStudentFeeInfo.Rows[0]["SerialNo"]); objModelStudentFee.AdmissionFee = DALUtility.isNumericDBNULL(tblStudentFeeInfo.Rows[0]["AdmissionFee"].ToString()); objModelStudentFee.Admission = DALUtility.isNumericDBNULL(tblStudentFeeInfo.Rows[0]["Admission"].ToString()); objModelStudentFee.ReAdmissionFee = DALUtility.isNumericDBNULL(tblStudentFeeInfo.Rows[0]["ReAdmissionFee"].ToString()); objModelStudentFee.RegistrationFee = DALUtility.isNumericDBNULL(tblStudentFeeInfo.Rows[0]["RegistrationFee"].ToString()); objModelStudentFee.MonthlyFee = DALUtility.isNumericDBNULL(tblStudentFeeInfo.Rows[0]["MonthlyFee"].ToString()); objModelStudentFee.ComputerFee = DALUtility.isNumericDBNULL(tblStudentFeeInfo.Rows[0]["ComputerFee"].ToString()); objModelStudentFee.Fine = DALUtility.isNumericDBNULL(tblStudentFeeInfo.Rows[0]["Fine"].ToString()); objModelStudentFee.ExamFee = DALUtility.isNumericDBNULL(tblStudentFeeInfo.Rows[0]["ExamFee"].ToString()); objModelStudentFee.GeneratorFee = DALUtility.isNumericDBNULL(tblStudentFeeInfo.Rows[0]["GeneratorFee"].ToString()); objModelStudentFee.FeeMonth = Convert.ToString(tblStudentFeeInfo.Rows[0]["FeeMonth"]); objModelStudentFee.Total = DALUtility.isNumericDBNULL(tblStudentFeeInfo.Rows[0]["Total"].ToString()); objModelStudentFee.FeePaidStatus = Convert.ToInt32(tblStudentFeeInfo.Rows[0]["FeePaidStatus"].ToString()); } return(objModelStudentFee); }
public List <ModelStudentFee> GetMonthlyFeeListByStudentID(decimal StudentID) { List <ModelStudentFee> objlstModelStudentFee = new List <ModelStudentFee>(); DataTable tblStudentFeeInfo = new DataTable(); SqlParameter[] paramStudentFee = new SqlParameter[1]; paramStudentFee[0] = new SqlParameter("@StudentId", StudentID); tblStudentFeeInfo = DALCommon.GetDataUsingDataTable("[sp_Admin_GetStudentMonthlyFeeByStudentId]", paramStudentFee); if (tblStudentFeeInfo.Rows.Count > 0) { foreach (DataRow studentFeeRow in tblStudentFeeInfo.Rows) { ModelStudentFee objModelStudentFee = new ModelStudentFee(); objModelStudentFee.FeeId = Convert.ToDouble(studentFeeRow["FeeId"]); objModelStudentFee.StudentId = Convert.ToInt32(studentFeeRow["StudentId"]); objModelStudentFee.ComputerCode = Convert.ToInt32(studentFeeRow["ComputerCode"]); objModelStudentFee.SerialNo = Convert.ToInt32(studentFeeRow["SerialNo"]); if (!DBNull.Value.Equals(studentFeeRow["FeeDate"])) { objModelStudentFee.FeeDate = Convert.ToDateTime(studentFeeRow["FeeDate"].ToString()); } else { objModelStudentFee.FeeDate = DateTime.Now; } objModelStudentFee.AdmissionFee = DALUtility.isNumericDBNULL(studentFeeRow["AdmissionFee"].ToString()); objModelStudentFee.Admission = DALUtility.isNumericDBNULL(studentFeeRow["Admission"].ToString()); objModelStudentFee.ReAdmissionFee = DALUtility.isNumericDBNULL(studentFeeRow["ReAdmissionFee"].ToString()); objModelStudentFee.RegistrationFee = DALUtility.isNumericDBNULL(studentFeeRow["RegistrationFee"].ToString()); objModelStudentFee.MonthlyFee = DALUtility.isNumericDBNULL(studentFeeRow["MonthlyFee"].ToString()); objModelStudentFee.ComputerFee = DALUtility.isNumericDBNULL(studentFeeRow["ComputerFee"].ToString()); objModelStudentFee.Fine = DALUtility.isNumericDBNULL(studentFeeRow["Fine"].ToString()); objModelStudentFee.ExamFee = DALUtility.isNumericDBNULL(studentFeeRow["ExamFee"].ToString()); objModelStudentFee.GeneratorFee = DALUtility.isNumericDBNULL(studentFeeRow["GeneratorFee"].ToString()); objModelStudentFee.FeeMonth = Convert.ToString(studentFeeRow["FeeMonth"]); objModelStudentFee.Total = DALUtility.isNumericDBNULL(studentFeeRow["Total"].ToString()); objModelStudentFee.FeePaidStatus = Convert.ToInt32(studentFeeRow["FeePaidStatus"]); objlstModelStudentFee.Add(objModelStudentFee); } } return(objlstModelStudentFee); }
public int UpdateStudentSinngleFeeInfoByFeeId(ModelStudentFee objModelStudentFee) { SqlParameter[] param = new SqlParameter[10]; param[0] = new SqlParameter("@FeeId", objModelStudentFee.FeeId); param[1] = new SqlParameter("@AdmissionFee", objModelStudentFee.AdmissionFee); param[2] = new SqlParameter("@Admission", objModelStudentFee.Admission); param[3] = new SqlParameter("@ReAdmissionFee", objModelStudentFee.ReAdmissionFee); param[4] = new SqlParameter("@RegistrationFee", objModelStudentFee.RegistrationFee); param[5] = new SqlParameter("@MonthlyFee", objModelStudentFee.MonthlyFee); param[6] = new SqlParameter("@ComputerFee", objModelStudentFee.ComputerFee); param[7] = new SqlParameter("@Fine", objModelStudentFee.Fine); param[8] = new SqlParameter("@ExamFee", objModelStudentFee.ExamFee); param[9] = new SqlParameter("@GeneratorFee", objModelStudentFee.GeneratorFee); return(DALCommon.ExecuteNonQuery("[sp_Admin_UpdateStudentSinngleFeeInfoByFeeId]", param)); }
public ActionResult GetStudentSingleFeeRecord(string feeID) { ModelStudentFee objModelStudentFee = new ModelStudentFee(); if (!String.IsNullOrEmpty(feeID.Trim())) { try { BLLStudentFee objBLLStudentFee = new BLLStudentFee(); objModelStudentFee = objBLLStudentFee.GetStudentSinngleFeeInfoByFeeId(Convert.ToDouble(feeID)); } catch (Exception ex) { DALUtility.ErrorLog(ex.Message, "StudentFeeController, GetStudentSingleFeeRecord"); } } return(PartialView(customview("_EditStudentMonthlyFeeInfo", "StudentFee"), objModelStudentFee)); }
public ActionResult UpdateStudentMonthlyFeeRecord(ModelStudentFee objModelStudentFee) { if (ModelState.IsValid) { if (objModelStudentFee != null) { try { BLLStudentFee objBLLStudentFee = new BLLStudentFee(); int _updateResult = 0; _updateResult = objBLLStudentFee.UpdateStudentSinngleFeeInfoByFeeId(objModelStudentFee); if (_updateResult > 0) { ModelStudent objModelStudent = new ModelStudent(); objBLLStudentFee = new BLLStudentFee(); objModelStudent = objBLLStudentFee.GetStudentFeeInfoById(Convert.ToDecimal(objModelStudentFee.StudentId)); Success("Fee Record Successfully Updated"); return(PartialView(customview("_GetFormStudentFeeInfo", "StudentFee"), objModelStudent)); } else { Error("Error occured while updating your fee record"); return(PartialView(customview("_EditStudentMonthlyFeeInfo", "StudentFee"), objModelStudentFee)); } } catch (Exception ex) { DALUtility.ErrorLog(ex.Message, "StudentFeeController, UpdateStudentMonthlyFeeRecord"); } } } Error("Record not Updated"); return(PartialView(customview("_EditStudentMonthlyFeeInfo", "StudentFee"), objModelStudentFee)); }
public ActionResult SaveBulkFeeInsertion(string dropDownClass, string dropDownSection, string dropDownMonthFee, string RegistrationFee, string Addmission, string AddmissionFee, string ReAdmission, string ComputerFee, string Fine, string ExamFee, string GeneratorFee) { try { BindDropdownlist(); BLLStudentFee objBLLStudentFee = new BLLStudentFee(); int ClassId = CheckObjNull(dropDownClass); int SectionId = CheckObjNull(dropDownSection); int dpSelectFeeMonth = CheckObjNull(dropDownMonthFee); int insertResult = 0; StringBuilder strSearchCriteria = new StringBuilder(); string searchCriteria = ""; if (dpSelectFeeMonth <= 0) { //Error("Fee month not selected. Please select proper fee month then again try to insert bulk fee record"); return(Json(new { code = 1, css = "error", message = "Fee month not selected. Please select proper fee month then again try to insert bulk fee record" })); //return View(); } if (ClassId <= 0 && SectionId > 0) { //Error("Must Select Class. Please select proper class before selecting section then again try to insert bulk fee record"); return(Json(new { code = 1, css = "error", message = "Must Select Class. Please select proper class before selecting section then again try to insert bulk fee record" })); //return View(); } //If Selected Class Is Not Empty if ((!string.IsNullOrEmpty(dropDownClass.Trim()))) { int _selectedClass = Convert.ToInt32(dropDownClass.Trim()); if (_selectedClass > 0) { strSearchCriteria.Append(" Students.ClassId = " + _selectedClass + " AND "); } } //If Class Section Is Not Empty if ((!string.IsNullOrEmpty(dropDownSection.Trim()))) { int _selectedSection = Convert.ToInt32(dropDownSection.Trim()); if (_selectedSection > 0) { strSearchCriteria.Append(" Students.SectionId = " + _selectedSection + " AND "); } } //If Filter Expression Is Not Null Or Empty if ((!string.IsNullOrEmpty(strSearchCriteria.ToString()))) { //Set Filter Expression searchCriteria = strSearchCriteria.ToString().Remove(strSearchCriteria.ToString().Length - 4, 4); } ModelStudentFee objModelStudentFee = new ModelStudentFee(); objModelStudentFee.RegistrationFee = CheckObjNull(RegistrationFee); objModelStudentFee.Admission = CheckObjNull(Addmission); objModelStudentFee.AdmissionFee = CheckObjNull(AddmissionFee); objModelStudentFee.ReAdmissionFee = CheckObjNull(ReAdmission); objModelStudentFee.GeneratorFee = CheckObjNull(GeneratorFee); objModelStudentFee.Fine = CheckObjNull(Fine); objModelStudentFee.ExamFee = CheckObjNull(ExamFee); objModelStudentFee.ComputerFee = CheckObjNull(ComputerFee); insertResult = objBLLStudentFee.InsertBulkStudentMonthlyFee(objModelStudentFee, searchCriteria, dpSelectFeeMonth); if (insertResult > 0) { //Success("Total Record :" + insertResult + " was Successfully Inserted for the Selected Month"); return(Json(new { code = 1, css = "error", message = "Total Record :" + insertResult + " was Successfully Inserted for the Selected Month" })); // return RedirectToAction("SaveBulkFeeInsertion"); // return View(); } } catch (Exception ex) { DALUtility.ErrorLog(ex.Message, "StudentFeeController, BulkFeeInsertion"); } return(View()); // return PartialView(customview("_BulkFeesPartialForm","StudentFee")); }
public int InsertStudentMonthlyFeeInsertTransaction(DataTable studentList, ModelStudentFee objModelStudentFee, int FeeMonth, decimal AddedBy) { //Initialization conn = new SqlConnection(ConnectionString()); strErrorMsg = string.Empty; intStatus = 0; int totalStudent = studentList.Rows.Count; int updatedTotalRecord = 0; try { //Open Connection if ((conn.State == System.Data.ConnectionState.Closed)) { conn.Open(); } //Begin Transaction sqlTrans = conn.BeginTransaction(); //Initialize Command cmd = new SqlCommand(); cmd.Connection = conn; cmd.Transaction = sqlTrans; //Update Transaction Response foreach (DataRow aStudent in studentList.Rows) { SqlParameter[] paramStudentFee = new SqlParameter[12]; paramStudentFee[0] = new SqlParameter("@StudentId", aStudent["StudentId"]); paramStudentFee[1] = new SqlParameter("@ComputerCode", aStudent["ComputerCode"]); paramStudentFee[2] = new SqlParameter("@FeeMonth", FeeMonth); paramStudentFee[3] = new SqlParameter("@MonthlyFee", aStudent["MonthlyFee"]); paramStudentFee[4] = new SqlParameter("@AdmissionFee", objModelStudentFee.AdmissionFee); paramStudentFee[5] = new SqlParameter("@Admission", objModelStudentFee.Admission); paramStudentFee[6] = new SqlParameter("@ReAdmissionFee", objModelStudentFee.ReAdmissionFee); paramStudentFee[7] = new SqlParameter("@RegistrationFee", objModelStudentFee.RegistrationFee); paramStudentFee[8] = new SqlParameter("@ComputerFee", objModelStudentFee.ComputerFee); paramStudentFee[9] = new SqlParameter("@Fine", objModelStudentFee.Fine); paramStudentFee[10] = new SqlParameter("@ExamFee", objModelStudentFee.ExamFee); paramStudentFee[11] = new SqlParameter("@GeneratorFee", objModelStudentFee.GeneratorFee); intStatus = DALCommon.ExecuteTransaction("[sp_Admin_InsertStudentMonthlyFeeBulkStudentId]", cmd, paramStudentFee); if (intStatus >= 1) { updatedTotalRecord = updatedTotalRecord + 1; } else { DALUtility.ErrorLogBulkFeeInsertion(aStudent["StudentId"].ToString(), aStudent["MonthlyFee"].ToString(), "Bulk Fee noy Insert", AddedBy.ToString()); } } if (totalStudent == updatedTotalRecord) { //Commit Transaction sqlTrans.Commit(); intStatus = 1; } else if (intStatus == -1) { strErrorMsg = "Error Occured while inserting record"; } else if (intStatus == -2) { strErrorMsg = "Fee already exists for this month"; } else if (intStatus == -3) { strErrorMsg = "Error occured while generation Serial Number index"; } else if (intStatus == -4) { strErrorMsg = "Student stucked off"; } //If Error Field Is Not Empty if ((!string.IsNullOrEmpty(strErrorMsg))) { DALUtility.ErrorLog(strErrorMsg, "BulkFeeInsertionTransaction.cs, InsertStudentMonthlyFeeInsertTransaction"); } } catch (Exception ex) { sqlTrans.Rollback(); DALUtility.ErrorLog(ex.Message, "BulkFeeInsertionTransaction.cs, InsertStudentMonthlyFeeInsertTransaction"); } finally { if ((conn.State == System.Data.ConnectionState.Open)) { conn.Close(); } cmd = null; sqlTrans = null; } return(intStatus); }