//public static DataSet GetCostIndications() //{ // IndicationOfCosts[] costs = EnumExtensions.ToEnumArray<IndicationOfCosts>( //} public static PredefinedBeneficiariesDetails GetPredefinedBeneficiary(int benefKey) { IDalSession session = NHSessionFactory.CreateSession(); PredefinedBeneficiariesDetails pbd = new PredefinedBeneficiariesDetails(); PredefinedBeneficiary pb = PredefinedBeneficiaryMapper.GetPredefinedBeneficiary(session, benefKey); if (pb != null) { pbd.Key = pb.Key; if (pb.SwiftAddress != null) pbd.SwiftAddress = pb.SwiftAddress; if (pb.BenefBankAcctNr != null) pbd.BankAcctNr = pb.BenefBankAcctNr; if (pb.NarBenef1 != null) pbd.NarBenef1 = pb.NarBenef1; if (pb.NarBenef2 != null) pbd.NarBenef2 = pb.NarBenef2; if (pb.NarBenef3 != null) pbd.NarBenef3 = pb.NarBenef3; if (pb.NarBenef4 != null) pbd.NarBenef4 = pb.NarBenef4; if (pb.Description1 != null) pbd.Description1 = pb.Description1; if (pb.Description2 != null) pbd.Description2 = pb.Description2; if (pb.Description3 != null) pbd.Description3 = pb.Description3; if (pb.Description4 != null) pbd.Description4 = pb.Description4; pbd.CostIndicationKey = (int)pb.CostIndication; } return pbd; }
private bool saveRecord() { bool blnSaveSuccess = false; Page.Validate(); if (Page.IsValid) { PredefinedBeneficiariesDetails pbd = new PredefinedBeneficiariesDetails(); pbd.Key = PredefinedBeneficiaryKey; pbd.BankAcctNr = tbBenefBankAcctNr.Text.Trim(); pbd.SwiftAddress = tbSwiftAddress.Text.Trim(); pbd.NarBenef1 = tbNarBenef1.Text; pbd.NarBenef2 = tbNarBenef2.Text; pbd.NarBenef3 = tbNarBenef3.Text; pbd.NarBenef4 = tbNarBenef4.Text; pbd.Description1 = tbDescription1.Text; pbd.Description2 = tbDescription2.Text; pbd.Description3 = tbDescription3.Text; pbd.Description4 = tbDescription4.Text; pbd.CostIndicationKey = int.Parse(this.ddlCostIndication.SelectedValue); if (string.IsNullOrEmpty(pbd.BankAcctNr) && string.IsNullOrEmpty(pbd.SwiftAddress)) throw new ApplicationException("Either Swift address or Bank Acct Nr are mandatory."); PredefinedBeneficiariesAdapter.SavePredefinedBeneficiary(ref blnSaveSuccess, ref pbd); } return blnSaveSuccess; }
public static void SavePredefinedBeneficiary(ref bool blnSaveSuccess, ref PredefinedBeneficiariesDetails pbd) { IDalSession session = NHSessionFactory.CreateSession(); int predBenefKey = pbd.Key; try { PredefinedBeneficiary predBenef = null; if (predBenefKey != 0) { predBenef = PredefinedBeneficiaryMapper.GetPredefinedBeneficiary(session, predBenefKey); } else { predBenef = new PredefinedBeneficiary(); } predBenef.SwiftAddress = pbd.SwiftAddress; predBenef.BenefBankAcctNr = pbd.BankAcctNr; predBenef.NarBenef1 = pbd.NarBenef1; predBenef.NarBenef2 = pbd.NarBenef2; predBenef.NarBenef3 = pbd.NarBenef3; predBenef.NarBenef4 = pbd.NarBenef4; predBenef.Description1 = pbd.Description1; predBenef.Description2 = pbd.Description2; predBenef.Description3 = pbd.Description3; predBenef.Description4 = pbd.Description4; predBenef.CostIndication = (IndicationOfCosts)pbd.CostIndicationKey; blnSaveSuccess = PredefinedBeneficiaryMapper.Update(session, predBenef); } finally { session.Close(); } }