Beispiel #1
0
 public BLL.Payment Payment_DALtoBLL(DAL.Payment d)
 {
     BLL.Payment P = d.toCopy <BLL.Payment>(new BLL.Payment());
     foreach (var d_Pd in d.PaymentDetails)
     {
         P.PDetails.Add(d_Pd.toCopy <BLL.PaymentDetail>(new BLL.PaymentDetail()));
     }
     return(P);
 }
Beispiel #2
0
 public BLL.Payment Payment_Find(string SearchText)
 {
     BLL.Payment PO = new BLL.Payment();
     try
     {
         DAL.Payment d = DB.Payments.Where(x => x.EntryNo == SearchText && x.Ledger.AccountGroup.CompanyId == Caller.CompanyId).FirstOrDefault();
         DB.Entry(d).Reload();
         if (d != null)
         {
             d.toCopy <BLL.Payment>(PO);
             PO.LedgerName = (d.Ledger ?? DB.Ledgers.Find(d.LedgerId) ?? new DAL.Ledger()).LedgerName;
             foreach (var d_pod in d.PaymentDetails)
             {
                 BLL.PaymentDetail b_pod = new BLL.PaymentDetail();
                 d_pod.toCopy <BLL.PaymentDetail>(b_pod);
                 PO.PDetails.Add(b_pod);
                 b_pod.LedgerName = (d_pod.Ledger ?? DB.Ledgers.Find(d_pod.LedgerId) ?? new DAL.Ledger()).LedgerName;
             }
         }
     }
     catch (Exception ex) { }
     return(PO);
 }