예제 #1
0
        private int DeleteTblSequenceProduction(TblSequenceProduction row, int index, string company)
        {
            using (var entity = new WorkFlowManagerDBEntities())
            {
                var query = (from e in entity.TblSequenceProductions
                             where e.Iserial == row.Iserial
                             select e).SingleOrDefault();
                if (query != null)
                {
                    entity.DeleteObject(query);
                }

                entity.SaveChanges();
            }
            return(row.Iserial);
        }
예제 #2
0
        static internal string HandelSequence(TblSequenceProduction journal)
        {
            var        temp       = "";
            var        tempFormat = "";
            const char aa         = '0';

            using (var entity = new WorkFlowManagerDBEntities())
            {
                for (var i = 0; i < journal.NumberOfInt; i++)
                {
                    tempFormat = tempFormat + aa;
                }
                var tempno = journal.NextRec;
                temp = tempno.ToString(tempFormat) + journal.Format;
                var seq = entity.TblSequenceProductions.FirstOrDefault(x => x.Iserial == journal.Iserial);
                if (seq != null)
                {
                    seq.NextRec = seq.NextRec + 1;
                }
                entity.SaveChanges();
            }
            return(temp);
        }
예제 #3
0
 private TblSequenceProduction UpdateOrInsertTblSequenceProductions(TblSequenceProduction newRow, bool save, int index, out int outindex, string company)
 {
     outindex = index;
     using (var entity = new WorkFlowManagerDBEntities())
     {
         if (save)
         {
             entity.TblSequenceProductions.AddObject(newRow);
         }
         else
         {
             var oldRow = (from e in entity.TblSequenceProductions
                           where e.Iserial == newRow.Iserial
                           select e).SingleOrDefault();
             if (oldRow != null)
             {
                 GenericUpdate(oldRow, newRow, entity);
             }
         }
         entity.SaveChanges();
         return(newRow);
     }
 }