Beispiel #1
0
 private TblStyleTNAColorDetail UpdateOrInsertTblStyleTNAColorDetail(TblStyleTNAColorDetail newRow, bool save, int index, int user, out int outindex)
 {
     outindex = index;
     try
     {
         using (var context = new WorkFlowManagerDBEntities())
         {
             if (save)
             {
                 context.TblStyleTNAColorDetails.AddObject(newRow);
             }
             else
             {
                 var oldRow = (from e in context.TblStyleTNAColorDetails
                               where e.Iserial == newRow.Iserial
                               select e).SingleOrDefault();
                 if (oldRow != null)
                 {
                     SharedOperation.GenericUpdate(oldRow, newRow, context);
                 }
             }
             context.SaveChanges();
             return(newRow);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #2
0
        private int DeleteTblStyleTNAColorDetail(TblStyleTNAColorDetail row)
        {
            using (var context = new WorkFlowManagerDBEntities())
            {
                var oldRow = (from e in context.TblStyleTNAColorDetails
                              where e.Iserial == row.Iserial
                              select e).SingleOrDefault();
                if (oldRow != null)
                {
                    context.DeleteObject(oldRow);
                }

                context.SaveChanges();
            }
            return(row.Iserial);
        }