예제 #1
0
        public ReceiptGenerator(ReceiptModel receiptModel)
        {
            _student = receiptModel.Student;
            _classTermFee = receiptModel.ClassTermFee;
            _school = receiptModel.School;
            _feePayment = _student.FeePayments.FirstOrDefault(x => x.ClassArmTermFeeId == _classTermFee.Id);

        }
예제 #2
0
        /// <summary>
        /// Update school details
        /// </summary>
        /// <param name="model">An instance of school class</param>
        /// <returns>true if success else false</returns>
        public bool Edit(School model)
        {
            try
            {
                _schoolRepository.Update(model);

                _auditTrailRepository.Log($"School {model.Name} Edited", AuditActionEnum.Updated);
                _log.Info("School Edited");
                return true;
            }
            catch (Exception ex)
            {
                _log.Error("Error", ex);
                return false;
            }
        }
예제 #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var schoolName = tboSchoolName.Text;
            var address = tboAddress.Text;
            var slogan = tboSlogan.Text;
            var logoPath = tboLogoPath.Text;
            var phoneNumbers = tboPhoneNumbers.Text;
            var sessionDateStarted = dtpSessionDateStarted.Text;
            var termDatedStarted = dtpTermDateStarted.Text;
            var presentSession = cboPresentSession.SelectedValue;
            var presentTerm = cboPresentTerm.SelectedValue;

            // Setup fees
            var jss1 = tboJss1.Text.Replace(",","");
            var jss2 = tboJss2.Text.Replace(",","");;
            var jss3 = tboJss3.Text.Replace(",","");;
            var sss1 = tboSss1.Text.Replace(",","");;
            var sss2 = tboSss2.Text.Replace(",","");;
            var sss3 = tboSss3.Text.Replace(",", ""); ;
            var jss = tboJss.Text.Replace(",","");;
            var sss = tboSss.Text.Replace(",", ""); ;

            // Check if all fields are filled

            if (presentSession != "" && presentTerm != "" && !string.IsNullOrWhiteSpace(jss1) &&
                !string.IsNullOrWhiteSpace(jss2) && !string.IsNullOrWhiteSpace(jss3) && !string.IsNullOrWhiteSpace(sss1) &&
                !string.IsNullOrWhiteSpace(sss2) && !string.IsNullOrWhiteSpace(sss3) && !string.IsNullOrWhiteSpace(jss) &&
                !string.IsNullOrWhiteSpace(sss) && !string.IsNullOrWhiteSpace(sss3) && !string.IsNullOrWhiteSpace(schoolName)
                && !string.IsNullOrWhiteSpace(address) && !string.IsNullOrWhiteSpace(slogan) && !string.IsNullOrWhiteSpace(logoPath)
                && !string.IsNullOrWhiteSpace(phoneNumbers))
            {
                decimal result;

                // Check if fees are numbers

                if (decimal.TryParse(jss1, out result) && decimal.TryParse(jss2, out result) &&
                    decimal.TryParse(jss3, out result) && decimal.TryParse(sss1, out result) &&
                    decimal.TryParse(sss2, out result) && decimal.TryParse(sss3, out result) &&
                    decimal.TryParse(jss, out result) && decimal.TryParse(sss, out result))
                {

                    var response = MessageBox.Show(@"Please confirm the information provided before proceeding. Are you sure you want to save?", @"School Setup", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);

                    if (response != DialogResult.Yes) return;

                    var school = new School()
                    {
                        Name = schoolName.ToUpper(),
                        PresentSession = presentSession.ToString(),
                        PresentTermEnum = (TermEnum)presentTerm,
                        SessionStart = Convert.ToDateTime(sessionDateStarted),
                        TermStart = Convert.ToDateTime(termDatedStarted),
                        Address = address,
                        PhoneNumbers = phoneNumbers.Split(',').Select(x => x.Trim()).ToList(),
                        LogoPath = Utilities.GetPermanentLogoPath(logoPath),
                        Slogan = slogan
                    };

                    _schoolRepository.SchoolSetup(school);

                    var classEnums = new List<ClassEnum>()
                    {
                        ClassEnum.JSS1,
                        ClassEnum.JSS2,
                        ClassEnum.JSS3,
                        ClassEnum.SSS1,
                        ClassEnum.SSS2,
                        ClassEnum.SSS3,
                        ClassEnum.JSS,
                        ClassEnum.SSS
                    };

                    var schoolFees = new List<decimal>()
                    {
                        Convert.ToDecimal(jss1),
                        Convert.ToDecimal(jss2),
                        Convert.ToDecimal(jss3),
                        Convert.ToDecimal(sss1),
                        Convert.ToDecimal(sss2),
                        Convert.ToDecimal(sss3),
                        Convert.ToDecimal(jss),
                        Convert.ToDecimal(sss)
                    };

                    var classTermFees = schoolFees.Select((fee, i) => new ClassTermFee()
                    {
                        ClassEnum = classEnums[i],
                        Session = presentSession.ToString(),
                        StartDate = DateTime.Now,
                        EndDate = null,
                        Active = true,
                        Fee = fee,
                        TermEnum = (TermEnum)presentTerm
                    }).ToList();

                    _activatedAndDeactivatedId = _classTermFeeRepository.AddClassTermFees(classTermFees, _username);

                    if (_activatedAndDeactivatedId == null)
                    {
                        MessageBox.Show(@"Something went wrong, Please restart the program and try again", ActiveForm.Text);
                        return;
                    }

                    MessageBox.Show(@"School Setup is Successful", ActiveForm.Text);

                    Hide();
                    new DashBoard(_username).ShowDialog();
                }
                else
                {
                    MessageBox.Show(@"Invalid entry in the fees textbox");
                }
            }
            else
            {
                MessageBox.Show(@"Please, all information are required");
            }
        }
예제 #4
0
 public bool Create(School model)
 {
     throw new NotImplementedException();
 }
예제 #5
0
        /// <summary>
        /// Used to setup school on first run of the application
        /// </summary>
        /// <param name="school">An instance of school class</param>
        /// <returns>School Id</returns>
        public string SchoolSetup(School school)
        {
            try
            {
                _schoolRepository.Add(school);

                _auditTrailRepository.Log($"School {school.Name} Created", AuditActionEnum.Created);
                _log.Info("School Created");
                return school.Id;
            }
            catch (Exception ex)
            {
                _log.Error("Error", ex);
                return null;
            }
        }
예제 #6
0
        private void PayFee_Load(object sender, EventArgs e)
        {
            lblFullName.Text = _row.Cells["FullName"].Value.ToString().ToUpper();
            lblClass.Text = _row.Cells["PresentClass"].Value.ToString();
            tboAmount.Text = _row.Cells["OutstandingFee"].Value.ToString();
            chkPrintReceipt.Checked = false;

            // Load school details
            _school = _schoolRepository.Get();
            cboSession.SelectedValue = _school.PresentSession;
            cboTerm.SelectedIndex = (int)_school.PresentTermEnum + 1;
        }