Ejemplo n.º 1
0
 internal void SaveMainRow()
 {
     if (SelectedMainRow.SalesAmount > 0 && SelectedMainRow.Qty > 0)
     {
         tblCalliopeStoresDailySale newRow = new tblCalliopeStoresDailySale()
         {
             SalesAmount = SelectedMainRow.SalesAmount,
             TblStore    = SelectedMainRow.TblStore,
             TransDate   = (DateTime)SelectedMainRow.TransDate,
             Qty         = SelectedMainRow.Qty,
         };
         lkpClient.SaveStoreDailySalesAsync(LoggedUserInfo.Iserial, LoggedUserInfo.DatabasEname, newRow);
         lkpClient.SaveStoreDailySalesCompleted += (s, sv) =>
         {
             if (sv.Result != null && sv.Result.Iserial > 0)
             {
                 MessageBox.Show("Data Saved Successfully");
             }
         };
     }
     else
     {
         MessageBox.Show("Invalid Qty or Amount ");
     }
 }
Ejemplo n.º 2
0
 public tblCalliopeStoresDailySale SaveStoreDailySales(int user, string company, tblCalliopeStoresDailySale newrow)
 {
     using (var context = new ccnewEntities(SharedOperation.GetSqlConnectionString(company)))
     {
         //if(newrow.Iserial == 0)
         //{
         newrow.CreatedBy    = user;
         newrow.CreationDate = DateTime.Now;
         context.tblCalliopeStoresDailySales.AddObject(newrow);
         //}
         //else
         //{
         //    var oldRow = context.tblCalliopeStoresDailySales.FirstOrDefault(x => x.Iserial == newrow.Iserial);
         //    oldRow.SalesAmount = newrow.SalesAmount;
         //    oldRow.LastUpdatedBy = user;
         //    oldRow.LastUpdatedDate = DateTime.Now;
         //    context.tblCalliopeStoresDailySales.AddObject(newrow);
         //}
         context.SaveChanges();
         var res = context.tblCalliopeStoresDailySales.FirstOrDefault(x => x.Iserial == newrow.Iserial);
         return(res);
     }
 }