Example #1
0
        private int DeleteTblRequestForSampleService(TblRequestForSampleService row)
        {
            using (var context = new WorkFlowManagerDBEntities())
            {
                var oldRow = (from e in context.TblRequestForSampleServices
                              where e.Iserial == row.Iserial
                              select e).SingleOrDefault();
                if (oldRow != null)
                {
                    context.DeleteObject(oldRow);
                }

                context.SaveChanges();
            }
            return(row.Iserial);
        }
Example #2
0
 private TblRequestForSampleService UpdateOrInsertTblRequestForSampleService(TblRequestForSampleService newRow, bool save, int index, out int outindex)
 {
     outindex = index;
     using (var context = new WorkFlowManagerDBEntities())
     {
         if (save)
         {
             context.TblRequestForSampleServices.AddObject(newRow);
         }
         else
         {
             var oldRow = (from e in context.TblRequestForSampleServices
                           where e.Iserial == newRow.Iserial
                           select e).SingleOrDefault();
             if (oldRow != null)
             {
                 GenericUpdate(oldRow, newRow, context);
             }
         }
         context.SaveChanges();
         return(newRow);
     }
 }