private void BindTreeView(Settings pSettings, bool pCompareWithCurrent) { Settings currentSettings = null; if (pCompareWithCurrent) currentSettings = ServicesProvider.GetInstance().GetSettingsImportExportServices().GetCurrentSettings(true); tvSettings.Nodes.Clear(); tvSettings.BeginUpdate(); foreach (SettingGroup group in pSettings.Groups) { string groupLabel = group.Name; if (!pCompareWithCurrent) groupLabel += " (" + group.Settings.Length + ")"; TreeNode groupNode = tvSettings.Nodes.Add(group.Name, groupLabel, "GRP"); groupNode.Checked = true; groupNode.Tag = group; foreach (Setting s in group.Settings) { TreeNode node = s.Value != null ? groupNode.Nodes.Add(s.Name, s.Name + " = " + s.Value, "SET") : groupNode.Nodes.Add(s.Name, s.Name, "PCK"); node.Checked = true; if (pCompareWithCurrent) { Setting foundsetting = currentSettings.MatchNames(group, s); if (foundsetting != null) { node.ImageKey = @"BAD"; node.Checked = true; if (foundsetting.Value != s.Value) { node.Text += @" ( =" + foundsetting.Value + @")"; } } } node.Tag = s; } } tvSettings.EndUpdate(); }
public Settings GetCurrentSettings(bool pIncludePackages) { Settings settings = new Settings(); // General parameters SettingGroup generalParameters = new SettingGroup(GENERAL_PARAMETERS); settings.Add(generalParameters); ApplicationSettings gp = ApplicationSettings.GetInstance(_user.Md5); generalParameters.Add(new Setting(OGeneralSettings.ACCOUNTINGPROCESS, ((int) gp.AccountingProcesses).ToString())); generalParameters.Add(new Setting(OGeneralSettings.ALLOWSMULTIPLELOANS, gp.IsAllowMultipleLoans.ToString())); generalParameters.Add(new Setting(OGeneralSettings.ALLOWSMULTIPLEGROUPS, gp.IsAllowMultipleGroups.ToString())); generalParameters.Add(new Setting(OGeneralSettings.BAD_LOAN_DAYS, gp.BadLoanDays.ToString())); generalParameters.Add(new Setting(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, gp.IsCalculationLateFeesDuringHolidays.ToString())); generalParameters.Add(new Setting(OGeneralSettings.CEASE_LAIE_DAYS, gp.CeaseLateDays.ToString())); generalParameters.Add(new Setting(OGeneralSettings.CITYMANDATORY, gp.IsCityMandatory.ToString())); generalParameters.Add(new Setting(OGeneralSettings.CITYOPENVALUE, gp.IsCityAnOpenValue.ToString())); generalParameters.Add(new Setting(OGeneralSettings.CONSOLIDATION_MODE, gp.ConsolidationMode.ToString())); generalParameters.Add(new Setting(OGeneralSettings.CONTRACT_CODE_TEMPLATE, gp.ContractCodeTemplate)); generalParameters.Add(new Setting(OGeneralSettings.COUNTRY, gp.Country)); generalParameters.Add(new Setting(OGeneralSettings.AUTOMATIC_ID, gp.IsAutomaticID.ToString())); generalParameters.Add(new Setting(OGeneralSettings.DONOTSKIPWEEKENDSININSTALLMENTSDATE, gp.DoNotSkipNonWorkingDays.ToString())); generalParameters.Add(new Setting(OGeneralSettings.ENFORCE_ID_PATTERN, gp.EnforceIDPattern.ToString())); generalParameters.Add(new Setting(OGeneralSettings.GROUPMINMEMBERS, gp.GroupMinMembers.ToString())); generalParameters.Add(new Setting(OGeneralSettings.GROUPMAXMEMBERS, gp.GroupMaxMembers.ToString())); generalParameters.Add(new Setting(OGeneralSettings.VILLAGEMINMEMBERS, gp.VillageMinMembers.ToString())); generalParameters.Add(new Setting(OGeneralSettings.VILLAGEMAXMEMBERS, gp.VillageMaxMembers.ToString())); generalParameters.Add(new Setting(OGeneralSettings.CLIENT_AGE_MIN, gp.ClientAgeMin.ToString())); generalParameters.Add(new Setting(OGeneralSettings.CLIENT_AGE_MAX, gp.ClientAgeMax.ToString())); generalParameters.Add(new Setting(OGeneralSettings.MAX_LOANS_COVERED, gp.MaxLoansCovered.ToString())); generalParameters.Add(new Setting(OGeneralSettings.MAX_GUARANTOR_AMOUNT, gp.MaxGuarantorAmount.ToString())); generalParameters.Add(new Setting(OGeneralSettings.ID_WILD_CHAR_CHECK, gp.IDWildCharCheck.ToString())); generalParameters.Add(new Setting(OGeneralSettings.ID_PATTERN, gp.IDPattern)); generalParameters.Add(new Setting(OGeneralSettings.INTERESTS_ALSO_CREDITED_IN_FL, gp.InterestsCreditedInFL.ToString())); generalParameters.Add(new Setting(OGeneralSettings.INCREMENTALDURINGDAYOFF, gp.IsIncrementalDuringDayOff.ToString())); generalParameters.Add(new Setting(OGeneralSettings.IMF_CODE, gp.ImfCode)); generalParameters.Add(new Setting(OGeneralSettings.LATEDAYSAFTERACCRUALCEASES, gp.LateDaysAfterAccrualCeases.ToString())); generalParameters.Add(new Setting(OGeneralSettings.MAX_NUMBER_INSTALLMENT, gp.MaxNumberInstallment.ToString())); ; generalParameters.Add(new Setting(OGeneralSettings.MFI_NAME, gp.MfiName)); generalParameters.Add(new Setting(OGeneralSettings.NAME_FORMAT, gp.FirstNameFormat)); generalParameters.Add(new Setting(OGeneralSettings.OLBBEFOREREPAYMENT, gp.IsOlbBeforeRepayment.ToString())); generalParameters.Add(new Setting(OGeneralSettings.PAYFIRSTINSTALLMENTREALVALUE, gp.PayFirstInterestRealValue.ToString())); generalParameters.Add(new Setting(OGeneralSettings.PENDING_SAVINGS_MODE, gp.PendingSavingsMode)); generalParameters.Add(new Setting(OGeneralSettings.SAVINGS_CODE_TEMPLATE, gp.SavingsCodeTemplate)); generalParameters.Add(new Setting(OGeneralSettings.USE_TELLER_MANAGEMENT, gp.UseTellerManagement.ToString())); generalParameters.Add(new Setting(OGeneralSettings.USEPROJECTS, gp.UseProjects.ToString())); generalParameters.Add(new Setting(OGeneralSettings.VAT_RATE, gp.VatRate.ToString())); generalParameters.Add(new Setting(OGeneralSettings.WEEKENDDAY1, gp.WeekEndDay1.ToString())); generalParameters.Add(new Setting(OGeneralSettings.WEEKENDDAY2, gp.WeekEndDay2.ToString())); generalParameters.Add(new Setting(OGeneralSettings.INTEREST_RATE_DECIMAL_PLACES, Convert.ToString(gp.InterestRateDecimalPlaces))); generalParameters.Add(new Setting(OGeneralSettings.STOP_WRITEOFF_PENALTY, Convert.ToString(gp.IsStopWriteOffPenalty.ToString()))); generalParameters.Add(new Setting(OGeneralSettings.MODIFY_ENTRY_FEE, Convert.ToString(gp.ModifyEntryFee.ToString()))); // Provisioning Rules SettingGroup provisioningRules = new SettingGroup(PROVISIONING_RULES); settings.Add(provisioningRules); foreach (ProvisioningRate prate in ProvisionTable.GetInstance(_user).ProvisioningRates) { provisioningRules.Add(new Setting(prate.NbOfDaysMin + "-" + prate.NbOfDaysMax, prate.ProvisioningValue.ToString())); } // Public Holidays SettingGroup publicHolidays = new SettingGroup(PUBLIC_HOLIDAYS); settings.Add(publicHolidays); foreach (DateTime entry in ServicesProvider.GetInstance().GetNonWorkingDate().PublicHolidays.Keys) { publicHolidays.Add(new Setting(ServicesProvider.GetInstance().GetNonWorkingDate().PublicHolidays[entry], (entry).ToString("dd/MM/yyyy"))); } //if (pIncludePackages) //{ // // Packages // SettingGroup packages = new SettingGroup(PACKAGES); // settings.Add(packages); // List<LoanProduct> allPackages = new ProductServices(_user).FindAllPackages(false, OClientTypes.Both); // foreach (LoanProduct package in allPackages) // { // Setting p = new Setting(package.Name, null); // //p.Package = package; // packages.Add(p); // } //} return settings; }
private Settings GetSelectedSettings() { Settings settings = new Settings(); foreach (TreeNode gnode in tvSettings.Nodes) { if ((gnode.Checked) || (NodeChildChecked(gnode))) { SettingGroup group = new SettingGroup(gnode.Name); settings.Add(group); foreach (TreeNode node in gnode.Nodes) { if (node.Checked) { Setting s = (Setting)node.Tag; group.Add(s); } } } } return settings; }
public void ApplySettings(Settings pSettings) { foreach (SettingGroup group in pSettings.Groups) { switch (group.Name) { case GENERAL_PARAMETERS: ApplyGeneralParameters(group); break; case PROVISIONING_RULES: ApplyProvisioningRules(group); break; case PUBLIC_HOLIDAYS: ApplyPublicHoliday(group); break; case PACKAGES: ApplyPackages(group); break; } } }