コード例 #1
0
        /// <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);
        }
コード例 #2
0
        /// <summary>
        /// This method gets the Payment Detail Table Data from querying the studentid in the Payment Detail Table.
        /// </summary>
        /// <param name="StudentId">Table Primary Key Id in Default Student Table.</param>
        /// <returns>Payment Status of a Student for all the months for transaction.</returns>
        public PaymentDetailCL getFeeDetailbyStudentId(int StudentId)
        {
            Payment_Detail  query  = (from x in dbcontext.Payment_Details where x.StudentId == StudentId select x).FirstOrDefault();
            PaymentDetailCL getFee = new PaymentDetailCL()
            {
                datecreated    = query.DateCreated,
                dateModified   = query.DateModified,
                id             = query.Id,
                isDeleted      = query.IsDeleted,
                leftFeesId     = query.LeftfeesId,
                modeOfPayment  = query.ModeOfPayment,
                studentId      = query.StudentId,
                leftFeesAmount = query.LeftFeesAmount,
            };

            return(getFee);
        }
コード例 #3
0
ファイル: FrontUserBLL.cs プロジェクト: mayankan/res-asp-fees
        /// <summary>
        /// This method deletes the Left Fee Table Collection which has been paid by the user.
        /// </summary>
        /// <param name="leftFeeCollection">Collection Input of fee Paid by the User</param>
        /// <returns>Number Count of Left Fee Collection Deleted</returns>
        public int deleteLeftFeePayment(Collection <PaymentDetailCL> paymentFeeCollection)
        {
            DateTime     dateHosting  = DateTime.UtcNow;
            TimeZoneInfo indianZoneId = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time");
            DateTime     dateNow      = TimeZoneInfo.ConvertTimeFromUtc(dateHosting, indianZoneId);
            int          i            = 0;

            foreach (PaymentDetailCL item in paymentFeeCollection)
            {
                Payment_Detail query = (from x in dbcontext.Payment_Details where x.Id == item.id select x).FirstOrDefault();
                query.isPaid       = true;
                query.DateModified = dateNow;
                if (query.Left_Fees.Month.Month == dateNow.Month)
                {
                    long   LateFeeOnDate = 0;
                    string date          = dateNow.Date.Day.ToString();
                    if (Convert.ToInt32(date) <= 10)
                    {
                        LateFeeOnDate = 0;
                    }
                    if (Convert.ToInt32(date) > 10 && Convert.ToInt32(date) <= 20)
                    {
                        LateFeeOnDate = 20;
                    }
                    if (Convert.ToInt32(date) > 20 && Convert.ToInt32(date) <= 31)
                    {
                        LateFeeOnDate = 30;
                    }
                    query.Left_Fees.LateFee  = LateFeeOnDate;
                    query.Left_Fees.TotalFee = query.Left_Fees.TotalFee + LateFeeOnDate;
                }
                query.LeftFeesAmount = query.Left_Fees.TotalFee;
                dbcontext.SaveChanges();
                i++;
            }
            return(i);
        }
コード例 #4
0
        /// <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);
        }