private int DeleteDyeingOrderInvoiceDetail(TblDyeingOrderInvoiceDetail row)
        {
            using (var context = new WorkFlowManagerDBEntities())
            {
                var oldRow = (from e in context.TblDyeingOrderInvoiceDetails
                              where e.Iserial == row.Iserial
                              select e).SingleOrDefault();
                if (oldRow != null)
                {
                    context.DeleteObject(oldRow);
                }

                context.SaveChanges();
            }
            return(row.Iserial);
        }
 private TblDyeingOrderInvoiceDetail UpdateOrInsertDyeingOrderInvoiceDetail(TblDyeingOrderInvoiceDetail newRow, bool save, int index, out int outindex)
 {
     outindex = index;
     using (var context = new WorkFlowManagerDBEntities())
     {
         if (save)
         {
             context.TblDyeingOrderInvoiceDetails.AddObject(newRow);
         }
         else
         {
             var oldRow = (from e in context.TblDyeingOrderInvoiceDetails
                           where e.Iserial == newRow.Iserial
                           select e).SingleOrDefault();
             if (oldRow != null)
             {
                 SharedOperation.GenericUpdate(oldRow, newRow, context);
             }
         }
         context.SaveChanges();
         return(newRow);
     }
 }