/// <summary> /// This method gets the Paid Fee Detail Table Data of Student Required Payment from querying the paidfeeid. /// </summary> /// <param name="paidFeeId">Paid Fee Id provided by Payment Detail Table to query Paid Fee Table.</param> /// <returns>Left Fee Details for a particular month</returns> public LeftFeesCL getLeftFeeById(int paidFeeId) { Left_Fee query = (from x in dbcontext.Left_Fees where x.Id == paidFeeId select x).FirstOrDefault(); LeftFeesCL getLeftFee = new LeftFeesCL() { id = query.Id, adminCharges = query.AdmissionFee, admissionFee = query.AdmissionFee, examinationFee = query.ExaminationFee, annualCharges = query.AnnualCharges, computerFeeMonthly = query.ComputerFeeMonthly, computerFeeYearly = query.ComputerFeeYearly, developmentChargesYearly = query.DevelopmentChargesYearly, labFee = query.LabFee, projectFee = query.ProjectFee, refreshmentAccFee = query.RefreshmentAccFee, smartClassCharges = query.SmartClassCharges, totalFee = query.TotalFee, tutionFee = query.TutionFee, transportFee = query.TransportFee, isDeleted = query.IsDeleted, dateModified = query.DateModified, dateCreated = query.DateCreated, month = query.Month, }; return(getLeftFee); }
/// <summary> /// This method creates new student data in the database. /// </summary> /// <param name="studentCL">Student Data entered by Backend User</param> /// <returns>Student Id created after adding Student.</returns> public int createStudent(StudentCL studentCL) { Student student = dbcontext.Students.Add(new Student { Address = studentCL.address, AdmissionNo = studentCL.admissionNo, Class = studentCL.studentClass, DateCreated = studentCL.dateCreated, DateModified = studentCL.dateModified, FathersName = studentCL.fathersname, Gender = studentCL.gender, IsDeleted = studentCL.isDeleted, MobileNumber = studentCL.mobileNumber, MothersName = studentCL.mothername, Name = studentCL.name, Section = studentCL.section, }); dbcontext.SaveChanges(); Left_Fee leftFee = dbcontext.Left_Fees.Add(new Left_Fee { AdminCharges = 0, AdmissionFee = 0, AnnualCharges = 0, ComputerFeeMonthly = 0, ComputerFeeYearly = 0, DateCreated = DateTime.Now, DateModified = DateTime.Now, DevelopmentChargesYearly = 0, IsDeleted = false, LabFee = 0, Month = DateTime.Now, ProjectFee = 0, RefreshmentAccFee = 0, SmartClassCharges = 0, TotalFee = 0, TutionFee = 0, }); dbcontext.SaveChanges(); Payment_Detail paymentDetail = dbcontext.Payment_Details.Add(new Payment_Detail { DateCreated = DateTime.Now, DateModified = DateTime.Now, IsDeleted = false, LeftFeesAmount = leftFee.TotalFee, LeftfeesId = leftFee.Id, ModeOfPayment = "Cash", StudentId = student.Id, }); dbcontext.SaveChanges(); return(student.Id); }
public int deleteFeeDatabyMonth(DateTime month) { int i = 0; IQueryable <Left_Fee> query = from x in dbcontext.Left_Fees where x.Month == month && x.IsDeleted == false select x; foreach (Left_Fee item in query) { Left_Fee query2 = (from x in dbcontext.Left_Fees where x.Id == item.Id select x).FirstOrDefault(); item.IsDeleted = true; i++; } dbcontext.SaveChanges(); return(i); }
/// <summary> /// This method creates the Fee Data Collection provided by User inputted excel and checks whether fee is paid or already there. /// </summary> /// <param name="feeCollection">Fee Data Collection provided by user for Creation.</param> /// <returns>The total number of fee data enties created or updated.</returns> public int createFeeCollection(Collection <FeeExcelCL> feeCollection) { int count = 0;//Counts the total number of Fee Entries sent to Database. foreach (FeeExcelCL item in feeCollection) { Student studentQuery = (from x in dbcontext.Students where x.AdmissionNo == item.admissionNo select x).FirstOrDefault(); //Query gets the student data from admission No. Payment_Detail paymentQuery = (from x in dbcontext.Payment_Details where x.StudentId == studentQuery.Id && x.Left_Fees.Month == item.month select x).FirstOrDefault(); if (paymentQuery == null) //Checks whether Payment Detail Table Data is present. { Left_Fee leftFee = dbcontext.Left_Fees.Add(new Left_Fee //Adds Left Fee Table in DB. { TutionFee = item.tutionFee, AdminCharges = item.adminCharges, AdmissionFee = item.admissionFee, ExaminationFee = item.examinationFee, AnnualCharges = item.annualCharges, ComputerFeeMonthly = item.computerFeeMonthly, ComputerFeeYearly = item.computerFeeYearly, DateCreated = item.dateCreated, DateModified = item.dateModified, DevelopmentChargesYearly = item.developmentChargesYearly, IsDeleted = false, LabFee = item.labFee, Month = item.month, ProjectFee = item.projectFee, RefreshmentAccFee = item.refreshmentAccFee, SmartClassCharges = item.smartClassCharges, TransportFee = item.transportFee, LateFee = item.lateFee, TotalFee = item.totalFee, }); dbcontext.SaveChanges(); dbcontext.Payment_Details.Add(new Payment_Detail()//Add Payment Detail Table after Left Fee Table in Database. { DateCreated = item.dateCreated, DateModified = item.dateModified, IsDeleted = false, LeftFeesAmount = item.totalFee, LeftfeesId = leftFee.Id, isPaid = false, ModeOfPayment = "None", StudentId = studentQuery.Id, }); count++; dbcontext.SaveChanges(); } else { if (paymentQuery.isPaid == true) { } else { paymentQuery.Left_Fees.TutionFee = item.tutionFee; paymentQuery.Left_Fees.AdminCharges = item.adminCharges; paymentQuery.Left_Fees.AdmissionFee = item.admissionFee; paymentQuery.Left_Fees.ExaminationFee = item.examinationFee; paymentQuery.Left_Fees.AnnualCharges = item.annualCharges; paymentQuery.Left_Fees.ComputerFeeMonthly = item.computerFeeMonthly; paymentQuery.Left_Fees.ComputerFeeYearly = item.computerFeeYearly; paymentQuery.Left_Fees.DateCreated = item.dateCreated; paymentQuery.Left_Fees.DateModified = item.dateModified; paymentQuery.Left_Fees.DevelopmentChargesYearly = item.developmentChargesYearly; paymentQuery.Left_Fees.IsDeleted = false; paymentQuery.Left_Fees.LabFee = item.labFee; paymentQuery.Left_Fees.Month = item.month; paymentQuery.Left_Fees.ProjectFee = item.projectFee; paymentQuery.Left_Fees.RefreshmentAccFee = item.refreshmentAccFee; paymentQuery.Left_Fees.SmartClassCharges = item.smartClassCharges; paymentQuery.Left_Fees.TransportFee = item.transportFee; paymentQuery.Left_Fees.LateFee = item.lateFee; paymentQuery.Left_Fees.TotalFee = item.totalFee; count++; dbcontext.SaveChanges(); } } } return(count); }