コード例 #1
0
 private void dgvDetails_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         BLL.ReceiptDetail pod = dgvDetails.SelectedItem as BLL.ReceiptDetail;
         pod.toCopy <BLL.ReceiptDetail>(data.RDetail);
     }
     catch (Exception ex) { }
 }
コード例 #2
0
ファイル: Receipt.cs プロジェクト: dineshbizsoft/NUBEAccount
 public bool Receipt_Save(BLL.Receipt PO)
 {
     try
     {
         DAL.Receipt d = DB.Receipts.Where(x => x.Id == PO.Id).FirstOrDefault();
         if (d == null)
         {
             d = new DAL.Receipt();
             DB.Receipts.Add(d);
             PO.toCopy <DAL.Receipt>(d);
             foreach (var b_pod in PO.RDetails)
             {
                 DAL.ReceiptDetail d_pod = new DAL.ReceiptDetail();
                 b_pod.toCopy <DAL.ReceiptDetail>(d_pod);
                 d.ReceiptDetails.Add(d_pod);
             }
             DB.SaveChanges();
             PO.Id = d.Id;
             LogDetailStore(PO, LogDetailType.INSERT);
         }
         else
         {
             foreach (var d_pod in d.ReceiptDetails)
             {
                 BLL.ReceiptDetail b_pod = PO.RDetails.Where(x => x.Id == d_pod.Id).FirstOrDefault();
                 if (b_pod == null)
                 {
                     d.ReceiptDetails.Remove(d_pod);
                 }
             }
             PO.toCopy <DAL.Receipt>(d);
             foreach (var b_pod in PO.RDetails)
             {
                 DAL.ReceiptDetail d_pod = d.ReceiptDetails.Where(x => x.Id == b_pod.Id).FirstOrDefault();
                 if (d_pod == null)
                 {
                     d_pod = new DAL.ReceiptDetail();
                     d.ReceiptDetails.Add(d_pod);
                 }
                 b_pod.toCopy <DAL.ReceiptDetail>(d_pod);
             }
             DB.SaveChanges();
             Clients.Clients(OtherLoginClientsOnGroup).Receipt_RefNoRefresh(Receipt_NewRefNo(DateTime.Now));
             LogDetailStore(PO, LogDetailType.UPDATE);
             //Journal_SaveByReceipt(PO);
         }
         return(true);
     }
     catch (Exception ex) { }
     return(false);
 }