/// <summary> /// /// </summary> /// <param name="AParameters"></param> public void SetControls(TParameterList AParameters) { // // If LedgerNumber hasn't been set yet, do nothing: if (FLedgerNumber < 0) { return; } lstDontPrint.BeginUpdate(); lstDontPrint.Items.Clear(); AFeesReceivableTable FeesReceivable = new AFeesReceivableTable(); Type DataTableType; DataTable CacheDT = TDataCache.GetCacheableDataTableFromPetraServer("FeesReceivableList", String.Empty, FLedgerNumber, out DataTableType); FeesReceivable.Merge(CacheDT); foreach (AFeesReceivableRow Row in FeesReceivable.Rows) { lstDontPrint.Items.Add(Row.FeeCode); } AFeesPayableTable FeesPayable = new AFeesPayableTable(); CacheDT = TDataCache.GetCacheableDataTableFromPetraServer("FeesPayableList", String.Empty, FLedgerNumber, out DataTableType); FeesPayable.Merge(CacheDT); foreach (AFeesPayableRow Row in FeesPayable.Rows) { lstDontPrint.Items.Add(Row.FeeCode); } lstDontPrint.EndUpdate(); String FeeStr = AParameters.Get("param_fee_codes").ToString(); // // If there's no fees selected, it's perhaps because the installation is new. // Add all the fees from the "Don't Print" box, up to the maximum number allowed. if (FeeStr == "") { Array.Resize(ref FSelectedFees, lstDontPrint.Items.Count); lstDontPrint.Items.CopyTo(FSelectedFees, 0); if (lstDontPrint.Items.Count > MAX_FEE_COUNT) { Array.Resize(ref FSelectedFees, MAX_FEE_COUNT); } } else { FSelectedFees = FeeStr.Split(','); } RefreshDoList(); }
/// <summary> /// /// </summary> /// <param name="AParameters"></param> public void SetControls(TParameterList AParameters) { // // If LedgerNumber hasn't been set yet, do nothing: if (FLedgerNumber < 0) { return; } AFeesReceivableTable FeesReceivable = new AFeesReceivableTable(); Type DataTableType; DataTable CacheDT = TDataCache.GetSpecificallyFilteredCacheableDataTableFromCache("FeesReceivableList", "Ledger", FLedgerNumber, out DataTableType); FeesReceivable.Merge(CacheDT); Array.Resize(ref FUnselectedFees, FeesReceivable.Rows.Count); for (Int32 Idx = 0; Idx < FeesReceivable.Rows.Count; Idx++) { AFeesReceivableRow Row = FeesReceivable[Idx]; FUnselectedFees[Idx] = Row.FeeCode; } AFeesPayableTable FeesPayable = new AFeesPayableTable(); CacheDT = TDataCache.GetSpecificallyFilteredCacheableDataTableFromCache("FeesPayableList", "Ledger", FLedgerNumber, out DataTableType); FeesPayable.Merge(CacheDT); Array.Resize(ref FUnselectedFees, FUnselectedFees.Length + FeesPayable.Rows.Count); for (Int32 Idx = 0; Idx < FeesPayable.Rows.Count; Idx++) { AFeesPayableRow Row = FeesPayable[Idx]; FUnselectedFees[FeesReceivable.Rows.Count + Idx] = Row.FeeCode; } String FeeStr = AParameters.Get("param_fee_codes").ToString(); // // If there's no fees selected, it's perhaps because the installation is new. // Add all the fees from the "Don't Print" box, up to the maximum number allowed. if (FeeStr == "") { Array.Resize(ref FSelectedFees, lstDontPrint.Items.Count); lstDontPrint.Items.CopyTo(FSelectedFees, 0); if (lstDontPrint.Items.Count > MAX_FEE_COUNT) { Array.Resize(ref FSelectedFees, MAX_FEE_COUNT); } } else { FSelectedFees = FeeStr.Split(','); } // Now I want to remove the selected items from the FSelectedFees list: for (Int32 Idx = 0; Idx < FSelectedFees.Length; Idx++) { Int32 pos = ((IList)FUnselectedFees).IndexOf(FSelectedFees[Idx]); if (pos >= 0) { Int32 NewLength = FUnselectedFees.Length - 1; for (Int32 i = pos; i < NewLength; i++) { FUnselectedFees[i] = FUnselectedFees[i + 1]; } Array.Resize(ref FUnselectedFees, NewLength); } } RefreshLists(); }