public static SystemSettingType GetPercentageofLoanAmountPaidType(FinancialEntities context)
        {
            var type = context.SystemSettingTypes.SingleOrDefault(entity => entity.Name == PercentageofLoanAmountPaid);
            InitialDatabaseValueChecker.ThrowIfNull<SystemSettingType>(type);

            return type;
        }
        public static SystemSettingType GetInvoiceGenerationTimingType(FinancialEntities context)
        {
            var type = context.SystemSettingTypes.SingleOrDefault(entity => entity.Name == InvoiceGenerationTiming);
            InitialDatabaseValueChecker.ThrowIfNull<SystemSettingType>(type);

            return type;
        }
Esempio n. 3
0
 protected void OnChange(object sender, DirectEventArgs e)
 {
     List<PartyType> partyType = new List<PartyType>();
     List<CustomerStatusType> cusStatType = new List<CustomerStatusType>();
     List<Country> country = new List<Country>();
     using (var context = new FinancialEntities())
     {
         partyType = context.PartyTypes.ToList();
         cusStatType = context.CustomerStatusTypes.ToList();
         country = context.Countries.ToList();
     }
     if (cmbFilterBy.SelectedItem.Text.Equals("Status"))
     {
         FilterStore.DataSource = cusStatType;
         cmbFilterBy2.Show();
     }
     else if (cmbFilterBy.SelectedItem.Text.Equals("Party Type"))
     {
         FilterStore.DataSource = partyType;
         cmbFilterBy2.Show();
     }
     else
     {
         cmbFilterBy2.Hide();
     }
     CountryStore.DataSource = country;
     CountryStore.DataBind();
     FilterStore.DataBind();
 }
        public static SystemSettingType GetGracePeriodType(FinancialEntities context)
        {
            var type = context.SystemSettingTypes.SingleOrDefault(entity => entity.Name == GracePeriod);
            InitialDatabaseValueChecker.ThrowIfNull<SystemSettingType>(type);

            return type;
        }
        public static UnitOfMeasure GetSemiMonthlyType(FinancialEntities context)
        {
            var type = context.UnitOfMeasures.SingleOrDefault(entity => entity.Name == SemiMonthly);
            InitialDatabaseValueChecker.ThrowIfNull<UnitOfMeasure>(type);

            return type;
        }
        public static SystemSettingType GetAllowableNumberofStraightLineLoanPerCustomerType(FinancialEntities context)
        {
            var type = context.SystemSettingTypes.SingleOrDefault(entity => entity.Name == AllowableNumberofStraightLineLoanPerCustomer);
            InitialDatabaseValueChecker.ThrowIfNull<SystemSettingType>(type);

            return type;
        }
Esempio n. 7
0
 public static AddressType GetPostalAddressType(FinancialEntities context)
 {
     AddressType postalAddressType = new AddressType();
     postalAddressType = context.AddressTypes.SingleOrDefault(entity => entity.Name == AddressTypeEnums.PostalAddress);
     InitialDatabaseValueChecker.ThrowIfNull<AddressType>(postalAddressType);
     return postalAddressType;
 }
        public static SystemSettingType GetDemandCollectionAfterType(FinancialEntities context)
        {
            var type = context.SystemSettingTypes.SingleOrDefault(entity => entity.Name == DemandCollectionAfter);
            InitialDatabaseValueChecker.ThrowIfNull<SystemSettingType>(type);

            return type;
        }
 public static PostalAddress GetCurrentPostalAddress(FinancialEntities context, Party party, PostalAddressType type, Func<Address, bool> condition)
 {
     Address address = party.Addresses.SingleOrDefault(entity => entity.EndDate == null && entity.PostalAddress.PostalAddressTypeId == type.Id && condition(entity));
     if (address != null)
         return address.PostalAddress;
     return null;
 }
Esempio n. 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (X.IsAjaxRequest == false && this.IsPostBack == false)
            {
                if (this.LoginInfo.UserType == UserAccountType.Teller.Name)
                {
                    btnEdit.Hidden = true;
                    btnSave.Hidden = true;
                    btnOpen.Hidden = true;
                }

                int id = int.Parse(Request.QueryString["id"]);
                hiddenId.Text = id.ToString();
                using (var context = new FinancialEntities())
                {
                    Holiday holiday = context.Holidays.SingleOrDefault(entity => entity.Id == id);
                    if (holiday != null)
                    {
                        this.txtName.Value = holiday.Name;
                        this.dtHoliday.SelectedDate = holiday.Date;
                        this.txtDesciption.Text = holiday.Description;
                        this.txtNotes.Text = holiday.Notes;
                    }
                    else
                    {
                        // TODO:: Don't know how to handle for now.
                    }
                }

                if (Holiday.GetById(id) == null)
                    throw new AccessToDeletedRecordException("The selected holiday has already been deleted by another user.");
            }
        }
        public static void CreateOrUpdatePostalAddress(FinancialEntities context, PostalAddress currentPostalAddress, PostalAddress newPostalAddress, DateTime now)
        {
            //check if is equal;
            bool equal = true;
            equal &= currentPostalAddress.Barangay == newPostalAddress.Barangay;
            equal &= currentPostalAddress.StreetAddress == newPostalAddress.StreetAddress;
            equal &= currentPostalAddress.Country == newPostalAddress.Country;
            equal &= currentPostalAddress.City == newPostalAddress.City;
            equal &= currentPostalAddress.Municipality == newPostalAddress.Municipality;
            equal &= currentPostalAddress.PostalCode == newPostalAddress.PostalCode;
            equal &= currentPostalAddress.Province == newPostalAddress.Province;
            equal &= currentPostalAddress.State == newPostalAddress.State;

            if (equal == false)
            {
                currentPostalAddress.Address.EndDate = now;

                Address address = new Address();
                address.Party = currentPostalAddress.Address.Party;
                address.AddressType = currentPostalAddress.Address.AddressType;
                address.EffectiveDate = now;

                newPostalAddress.Address = address;
                newPostalAddress.PostalAddressType = currentPostalAddress.PostalAddressType;
                context.PostalAddresses.AddObject(newPostalAddress);
            }
        }
Esempio n. 12
0
        public int checkBranch()
        {
            int result = 0;
            var name = txtName.Text;
            using (var context = new FinancialEntities())
            {
                // check if inputed name equal to organization name
                var bankRoleType = context.RoleTypes.SingleOrDefault(entity => entity.Name == RoleTypeEnums.Bank);
                InitialDatabaseValueChecker.ThrowIfNull<RoleType>(bankRoleType);

                var sameBankName = context.BankViewLists.FirstOrDefault(entity => entity.Organization_Name == name);
                if (sameBankName != null)
                {
                    hiddenID.Value = sameBankName.PartyRoleID;
                    result = 1;
                }
                else
                {
                    var sameNameNotBank = context.PartyRoles.FirstOrDefault(entity => entity.Party.Organization.OrganizationName == name && entity.EndDate == null
                        && entity.RoleTypeId != RoleType.BankType.Id);
                    if (sameNameNotBank != null)
                    {
                        hiddenID.Value = sameNameNotBank.PartyId;
                        result = 2;
                    }
                }
            }
            return result;
        }
Esempio n. 13
0
 public static AddressType GetTelecommunicationNumberType(FinancialEntities context)
 {
     AddressType telecommunicationNumberType = new AddressType();
     telecommunicationNumberType = context.AddressTypes.SingleOrDefault(entity => entity.Name == AddressTypeEnums.TelecommunicationNumber);
     InitialDatabaseValueChecker.ThrowIfNull<AddressType>(telecommunicationNumberType);
     return telecommunicationNumberType;
 }
 public static PostalAddressType GetPropertyLocationAddressType(FinancialEntities context)
 {
     PostalAddressType propertyLocationAddressType = new PostalAddressType();
     propertyLocationAddressType = context.PostalAddressTypes.SingleOrDefault(entity => entity.Name == PostalAddressTypeEnums.PropertyLocation);
     InitialDatabaseValueChecker.ThrowIfNull<PostalAddressType>(propertyLocationAddressType);
     return propertyLocationAddressType;
 }
 public static PostalAddressType GetHomeAddressType(FinancialEntities context)
 {
     PostalAddressType homeAddressType = new PostalAddressType();
     homeAddressType = context.PostalAddressTypes.SingleOrDefault(entity => entity.Name == PostalAddressTypeEnums.HomeAddress);
     InitialDatabaseValueChecker.ThrowIfNull<PostalAddressType>(homeAddressType);
     return homeAddressType;
 }
 public static PostalAddressType GetBirthPlaceAddressType(FinancialEntities context)
 {
     PostalAddressType birthplaceType = new PostalAddressType();
     birthplaceType = context.PostalAddressTypes.SingleOrDefault(entity => entity.Name == PostalAddressTypeEnums.Birthplace);
     InitialDatabaseValueChecker.ThrowIfNull<PostalAddressType>(birthplaceType);
     return birthplaceType;
 }
Esempio n. 17
0
 public static RoleType GetGuarantorRoleType(FinancialEntities context)
 {
     var domainApplication = GetDomainApplicationRoleType(context);
     var type = context.RoleTypes.SingleOrDefault(entity => entity.Name == Guarantor && entity.ParentRoleTypeId == domainApplication.Id);
     InitialDatabaseValueChecker.ThrowIfNull<RoleType>(type);
     return type;
 }
        public static PersonName GetPersonNameByTypeEntity(FinancialEntities context, Person person, string type)
        {
            var personNameType = context.PersonNameTypes.SingleOrDefault(entity => entity.Name == type);
            InitialDatabaseValueChecker.ThrowIfNull<PersonNameType>(personNameType);

            var personName = person.PersonNames.SingleOrDefault(entity => entity.PersonNameTypeId == personNameType.Id && entity.EndDate == null);
            return personName;
        }
 public static PostalAddress GetCurrentPostalAddressV2(FinancialEntities context, Party party, PostalAddressType type, Func<PostalAddress, bool> condition)
 {
     PostalAddress postalAddress = context.PostalAddresses.SingleOrDefault(entity =>entity.Address.PartyId == party.Id &&
         entity.Address.EndDate == null && entity.PostalAddressTypeId == type.Id && condition(entity));
     //Address address = party.Addresses.SingleOrDefault(entity => entity.EndDate == null && entity.PostalAddress.PostalAddressTypeId == type.Id && condition(entity));
     //if (address != null)
     //    return address.PostalAddress;
     return postalAddress;
 }
 protected void checkDistrict(object sender, RemoteValidationEventArgs e)
 {
     int count = 0;
     using (var context = new FinancialEntities())
     {
         count = context.ClassificationTypes.Where(entity => entity.District == this.District.Text).Count();
     }
     e.Success = count == 0;
     if (count > 0)
         e.ErrorMessage = "Customer classification record already exists.";
 }
        public static PostalAddress CreatePostalAddress(FinancialEntities context, Party party, PostalAddressType type, DateTime now)
        {
            Address address = new Address();
            address.Party = party;
            address.AddressType = AddressTypeEnums.GetPostalAddressType(context);
            address.EffectiveDate = now;

            PostalAddress postalAddress = new PostalAddress();
            postalAddress.Address = address;
            postalAddress.PostalAddressType = type;
            return postalAddress;
        }
        public static PersonName CreatePersonName(FinancialEntities context, string nameType, string name, Person person)
        {
            var personNameType = context.PersonNameTypes.SingleOrDefault(entity => entity.Name == nameType);
            InitialDatabaseValueChecker.ThrowIfNull<PersonNameType>(personNameType);

            PersonName personName = new PersonName();
            personName.Name = name;
            personName.PersonNameType = personNameType;
            personName.Person = person;
            personName.EffectiveDate = DateTime.Now;
            return personName;
        }
        public static void CreateOrUpdatePersonNames(FinancialEntities context, Person person, string type, string name, DateTime today)
        {
            PersonName personName = GetPersonNameByTypeEntity(context, person, type);

            if (personName == null || name != personName.Name)
            {
                if (personName != null)
                    personName.EndDate = today;
                PersonName newPersonName = CreatePersonName(context, type, name, person);
                context.PersonNames.AddObject(newPersonName);
            }
        }
Esempio n. 24
0
 protected void btnSave_Click(object sender, DirectEventArgs e)
 {
     using (var context = new FinancialEntities())
     {
         int id = int.Parse(this.hiddenId.Text);
         Holiday holiday = context.Holidays.SingleOrDefault(entity => entity.Id == id);
         holiday.Name = this.txtName.Text;
         holiday.Date = this.dtHoliday.SelectedDate;
         holiday.Description = this.txtDesciption.Text;
         holiday.Notes = this.txtNotes.Text;
         context.SaveChanges();
     }
 }
Esempio n. 25
0
 protected void btnSave_Click(object sender, DirectEventArgs e)
 {
     using (var context = new FinancialEntities())
     {
         Holiday holiday = new Holiday();
         holiday.Name = this.txtName.Text;
         holiday.Date = this.dtHoliday.SelectedDate;
         holiday.Description = this.txtDesciption.Text;
         holiday.Notes = this.txtNotes.Text;
         context.Holidays.AddObject(holiday);
         context.SaveChanges();
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (X.IsAjaxRequest == false && this.IsPostBack == false)
            {
                using (var context = new FinancialEntities())
                {
                    txtGracePeriod.Text = GetCurrentSetting(context, SystemSettingsEnums.GracePeriod);
                    txtInvoice.Text = GetCurrentSetting(context, SystemSettingsEnums.InvoiceGenerationTiming);
                    txtDemand.Text = GetCurrentSetting(context, SystemSettingsEnums.DemandCollectionAfter);
                    txtAgeLimit.Text = GetCurrentSetting(context, SystemSettingsEnums.AgeLimitOfBorrower);

                    //
                    txtPercentage.Text = GetCurrentSetting(context, SystemSettingsEnums.PercentageOfLoanAmountPaid);
                    if (txtPercentage.Text.Equals(""))
                    {
                        rdApplyNo.Checked = true;
                        txtPercentage.Disabled = true;
                    }
                    else
                    {
                        rdApplyYes.Checked = true;
                    }

                    cbCalculate.Text = GetCurrentSetting(context, SystemSettingsEnums.CalculatePenalty);

                    //
                    txtAllowDelWithAge.Text = GetCurrentSetting(context, SystemSettingsEnums.AllowDeleteOnLoansWithAge);
                    if (txtAllowDelWithAge.Text.Equals(""))
                    {
                        rdAllowNo.Checked = true;
                        txtAllowDelWithAge.Disabled = true;
                    }
                    else
                    {
                        rdAllowYes.Checked = true;
                    }

                    var paymentDateOption = GetCurrentSetting(context, SystemSettingType.DatePaymentOptionType.Name);
                    if (paymentDateOption == "1") radioAfter.Checked = true;
                    else if(paymentDateOption == "0") radioBefore.Checked = true;

                    txtMaxAmountAppovableByClerk.Text = GetCurrentSetting(context, SystemSettingsEnums.ClerksMaximumHonorableAmount);
                    txtStraightLine.Text = GetCurrentSetting(context, SystemSettingsEnums.StraightLineLoan);
                    txtDiminishing.Text = GetCurrentSetting(context, SystemSettingsEnums.DiminishingBalanceLoan);

                    //var advanceChangeDay = GetCurrentSetting(context, SystemSettingsEnums.AdvanceChangeNoInterestStartDay);
                    cmbAdvanceChangeNoInterestStartDay.SelectedItem.Value = GetCurrentSetting(context, SystemSettingsEnums.AdvanceChangeNoInterestStartDay);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (X.IsAjaxRequest == false && this.IsPostBack == false)
            {

                using (var context = new FinancialEntities())
                {
                    var loanTerm = from uom in context.UnitOfMeasures
                                   where uom.UnitOfMeasureType.Name == "Time Unit"
                               select new
                               {
                                    Id = uom.Id,
                                    Name = uom.Name
                               };
                    var paymentMode = from uom in context.UnitOfMeasures
                                   where uom.UnitOfMeasureType.Name == "Time Frequency"
                                   select new
                                   {
                                       Id = uom.Id,
                                       Name = uom.Name
                                   };
                    var interestMode = from pf in context.ProductFeatures
                                      where pf.ProductFeatureCategory.Name == "Interest Computation Mode"
                                      select new
                                      {
                                          Id = pf.Id,
                                          Name = pf.Name
                                      };
                    var methodOfCharging = from pf in context.ProductFeatures
                                           where pf.ProductFeatureCategory.Name == "Method of Charging Interest"
                                           select new
                                           {
                                               Id = pf.Id,
                                               Name = pf.Name
                                           };
                    StoreLoanTerm.DataSource = loanTerm.ToList();
                    StorePaymentMode.DataSource = paymentMode.ToList();
                    StoreInterest.DataSource = interestMode.ToList();
                    StoreMethodOfCharging.DataSource = methodOfCharging.ToList();
                    StoreLoanTerm.DataBind();
                    StorePaymentMode.DataBind();
                    StoreInterest.DataBind();
                    StoreMethodOfCharging.DataBind();
                }

            }
        }
        protected void btnSave_Click(object sender, DirectEventArgs e)
        {
            using (var context = new FinancialEntities())
            {
                ClassificationType classification = new ClassificationType();
                classification.District = this.District.Text;
                classification.StationNumber = this.StationNumber.Text;

                var selectedDistrict = this.cmbDistrictType.SelectedIndex;
                if (selectedDistrict != -1)
                {
                    classification.DistrictTypeId = int.Parse(this.cmbDistrictType.SelectedItem.Value);
                }

                context.ClassificationTypes.AddObject(classification);
                context.SaveChanges();
            }
        }
        protected void btnSave_Click(object sender, DirectEventArgs e)
        {
            using (var context = new FinancialEntities())
            {
                int id = int.Parse(this.RecordID.Text);
                ClassificationType classification = context.ClassificationTypes.SingleOrDefault(entity => entity.Id == id);
                classification.District = this.District.Text;
                classification.StationNumber = this.StationNumber.Text;

                var selectedDistrict = this.cmbDistrictType.SelectedIndex;
                if (selectedDistrict != -1)
                {
                    classification.DistrictTypeId = int.Parse(this.cmbDistrictType.SelectedItem.Value);
                }

                context.SaveChanges();
            }
        }
        public int checkOrganizationName()
        {
            int result = 0;
            var name = txtName.Text;
            using (var context =  new FinancialEntities())
            {
                var sameOrgName = context.ContactViewLists.FirstOrDefault(entity =>
                    entity.Name == name);

                if (sameOrgName != null)
                {
                    hiddenID.Value = sameOrgName.PartyRoleId;
                    result = 1;
                }
            }

            return result;
        }
Esempio n. 31
0
 private void OnGenerateWordDoc()
 {
     try
     {
         WordDocGenerator wordDocGenerator = new WordDocGenerator();
         var finaincialList = FinancialEntities.ToList();
         var totalInfo      = new FinancialInfoTotal();
         totalInfo.TotalText = "Total";
         foreach (var financialInfo in finaincialList)
         {
             totalInfo.TotalNBOfProvServ  += financialInfo.NumberOfProvServ;
             totalInfo.DentalPrice        += financialInfo.DentalPrice;
             totalInfo.PriceDueToContract += financialInfo.PriceDueToContract;
             totalInfo.TotalPriceProvServ += financialInfo.TotalPriceProvServ;
             totalInfo.TotalDueToContract += financialInfo.TotalDueToContract;
         }
         wordDocGenerator.CreateTable(finaincialList, totalInfo, GenerateTableInfoViewModel.Year, GenerateTableInfoViewModel.SelectedMonth, GenerateTableInfoViewModel.Provider, GenerateTableInfoViewModel.Beneficiary);
     }
     catch (Exception)
     {
         MessageBox.Show("Pentru a genera fisierul word creati tabelul intai");
     }
 }