private void ShowDetailsManual(AMotivationDetailRow ARow) { string FeesPayable = string.Empty; string FeesReceivable = string.Empty; if (ARow != null) { FMainDS.AMotivationDetailFee.DefaultView.RowFilter = String.Format("{0}={1} and {2}='{3}' and {4}='{5}'", AMotivationDetailFeeTable.GetLedgerNumberDBName(), ARow.LedgerNumber, AMotivationDetailFeeTable.GetMotivationGroupCodeDBName(), ARow.MotivationGroupCode, AMotivationDetailFeeTable.GetMotivationDetailCodeDBName(), ARow.MotivationDetailCode); foreach (DataRowView rv in FMainDS.AMotivationDetailFee.DefaultView) { AMotivationDetailFeeRow detailFeeRow = (AMotivationDetailFeeRow)rv.Row; if (StringHelper.StrSplit(clbDetailFeesPayable.GetAllStringList(), ",").Contains(detailFeeRow.FeeCode)) { FeesPayable = StringHelper.AddCSV(FeesPayable, detailFeeRow.FeeCode); } else { FeesReceivable = StringHelper.AddCSV(FeesReceivable, detailFeeRow.FeeCode); } } } // set the ORDER column to true if row is checked clbDetailFeesPayable.CheckedColumn = "ORDER"; clbDetailFeesReceivable.CheckedColumn = "ORDER"; clbDetailFeesPayable.SetCheckedStringList(FeesPayable); clbDetailFeesReceivable.SetCheckedStringList(FeesReceivable); // set the CHECKED column to true if row is checked clbDetailFeesPayable.CheckedColumn = "CHECKED"; clbDetailFeesReceivable.CheckedColumn = "CHECKED"; clbDetailFeesPayable.SetCheckedStringList(FeesPayable); clbDetailFeesReceivable.SetCheckedStringList(FeesReceivable); if (FTaxDeductiblePercentageEnabled) { if (ARow.IsTaxDeductibleAccountNull()) { cmbDeductibleAccountCode.SelectedIndex = 0; } else { cmbDeductibleAccountCode.SetSelectedString(ARow.TaxDeductibleAccount); } } }
private void GetDetailDataFromControlsManual(AMotivationDetailRow ARow) { StringCollection TickedFees = StringHelper.StrSplit( StringHelper.ConcatCSV(clbDetailFeesPayable.GetCheckedStringList(), clbDetailFeesReceivable.GetCheckedStringList()), ","); FMainDS.AMotivationDetailFee.DefaultView.RowFilter = String.Format("{0}={1} and {2}='{3}' and {4}='{5}'", AMotivationDetailFeeTable.GetLedgerNumberDBName(), ARow.LedgerNumber, AMotivationDetailFeeTable.GetMotivationGroupCodeDBName(), ARow.MotivationGroupCode, AMotivationDetailFeeTable.GetMotivationDetailCodeDBName(), ARow.MotivationDetailCode); StringCollection ExistingFees = new StringCollection(); foreach (DataRowView rv in FMainDS.AMotivationDetailFee.DefaultView) { AMotivationDetailFeeRow detailFeeRow = (AMotivationDetailFeeRow)rv.Row; if (!TickedFees.Contains(detailFeeRow.FeeCode)) { // delete existing fees that have been unticked detailFeeRow.Delete(); } else { ExistingFees.Add(detailFeeRow.FeeCode); } } // add new fees foreach (string fee in TickedFees) { if (!ExistingFees.Contains(fee)) { AMotivationDetailFeeRow NewRow = FMainDS.AMotivationDetailFee.NewRowTyped(); NewRow.LedgerNumber = ARow.LedgerNumber; NewRow.MotivationGroupCode = ARow.MotivationGroupCode; NewRow.MotivationDetailCode = ARow.MotivationDetailCode; NewRow.FeeCode = fee; FMainDS.AMotivationDetailFee.Rows.Add(NewRow); } } if (FTaxDeductiblePercentageEnabled) { ARow.TaxDeductibleAccount = cmbDeductibleAccountCode.GetSelectedString(); } }