Example #1
0
        private void CheckExistingInstallmentType(InstallmentType pInstallmentType, bool?editMode = null)
        {
            List <InstallmentType> list = _installmentTypeManager.SelectAllInstallmentTypes();

            foreach (InstallmentType type in list)
            {
                if (editMode == true)
                {
                    if (type.Id != pInstallmentType.Id &&
                        type.Name.ToLower() == pInstallmentType.Name.ToLower() &&
                        type.NbOfDays == pInstallmentType.NbOfDays &&
                        type.NbOfMonths == pInstallmentType.NbOfMonths)
                    {
                        throw new OpenCbsPackageSaveException(
                                  OpenCbsPackageSaveExceptionEnum.InstallmentTypeNameAlreadyExist);
                    }
                }
                else
                {
                    if (type.Name.ToLower() == pInstallmentType.Name.ToLower() &&
                        type.NbOfDays == pInstallmentType.NbOfDays &&
                        type.NbOfMonths == pInstallmentType.NbOfMonths)
                    {
                        throw new OpenCbsPackageSaveException(
                                  OpenCbsPackageSaveExceptionEnum.InstallmentTypeNameAlreadyExist);
                    }
                }
            }
        }
Example #2
0
        public int AddInstallmentType(InstallmentType pInstallmentType)
        {
            List <InstallmentType> list = _installmentTypeManager.SelectAllInstallmentTypes();

            foreach (InstallmentType type in list)
            {
                if (type.Name.ToLower() == pInstallmentType.Name.ToLower())
                {
                    throw new OpenCbsPackageSaveException(OpenCbsPackageSaveExceptionEnum.InstallmentTypeNameAlreadyExist);
                }
                if (type.NbOfDays == pInstallmentType.NbOfDays && type.NbOfMonths == pInstallmentType.NbOfMonths)
                {
                    throw new OpenCbsPackageSaveException(OpenCbsPackageSaveExceptionEnum.InstallmentTypeValuesAlreadyExist);
                }
            }
            return(_installmentTypeManager.AddInstallmentType(pInstallmentType));
        }
Example #3
0
        public void SelectAllInstallmentTypes()
        {
            InstallmentTypeManager installmentTypeManager = (InstallmentTypeManager)container["InstallmentTypeManager"];

            List <InstallmentType> selectedList = installmentTypeManager.SelectAllInstallmentTypes();

            Assert.AreEqual(2, selectedList.Count);

            _AssertInstallmentType(selectedList[0], 1, "monthly", 0, 1);
            _AssertInstallmentType(selectedList[1], 2, "weekly", 7, 0);
        }
 public List <InstallmentType> GetAllInstallmentTypes()
 {
     return(_installmentTypeManager.SelectAllInstallmentTypes());
 }