示例#1
0
 public void ResetID(string entity, long id)
 {
     try
     {
         AttendanceDataContext dc = AttendanceDataContextFactory.Createattendance(_ConnStr);
         IntegerID             ii = dc.GetTable <IntegerID>().SingleOrDefault(item => item.Entity == entity);
         if (ii == null)
         {
             ii = new IntegerID()
             {
                 Entity = entity, Value = id
             };
             dc.GetTable <IntegerID>().InsertOnSubmit(ii);
             dc.SubmitChanges();
         }
         else
         {
             ii.Value = id;
             dc.SubmitChanges();
         }
     }
     catch (Exception ex)
     {
         LJH.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex);
     }
 }
示例#2
0
        public long?GetCurID(string entity)
        {
            long?id = null;
            AttendanceDataContext dc = AttendanceDataContextFactory.Createattendance(_ConnStr);
            IntegerID             ii = dc.GetTable <IntegerID>().SingleOrDefault(item => item.Entity == entity);

            if (ii != null)
            {
                id = ii.Value;
            }
            return(id);
        }
 public long? CreateID(string entity)
 {
     long? id = null;
     AttendanceDataContext dc = AttendanceDataContextFactory.Createattendance(_ConnStr);
     IntegerID ii = dc.GetTable<IntegerID>().SingleOrDefault(item => item.Entity == entity);
     if (ii == null)
     {
         ii = new IntegerID() { Entity = entity, Value = 2 };
         dc.GetTable<IntegerID>().InsertOnSubmit(ii);
         dc.SubmitChanges();
         id = 1;
     }
     else
     {
         id = ii.Value;
         ii.Value += 1;
         dc.SubmitChanges();
     }
     return id;
 }
 public void ResetID(string entity, long id)
 {
     try
     {
         AttendanceDataContext dc = AttendanceDataContextFactory.Createattendance(_ConnStr);
         IntegerID ii = dc.GetTable<IntegerID>().SingleOrDefault(item => item.Entity == entity);
         if (ii == null)
         {
             ii = new IntegerID() { Entity = entity, Value = id };
             dc.GetTable<IntegerID>().InsertOnSubmit(ii);
             dc.SubmitChanges();
         }
         else
         {
             ii.Value = id;
             dc.SubmitChanges();
         }
     }
     catch (Exception ex)
     {
         LJH.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex);
     }
 }
示例#5
0
        public long?CreateID(string entity)
        {
            long?id = null;
            AttendanceDataContext dc = AttendanceDataContextFactory.Createattendance(_ConnStr);
            IntegerID             ii = dc.GetTable <IntegerID>().SingleOrDefault(item => item.Entity == entity);

            if (ii == null)
            {
                ii = new IntegerID()
                {
                    Entity = entity, Value = 2
                };
                dc.GetTable <IntegerID>().InsertOnSubmit(ii);
                dc.SubmitChanges();
                id = 1;
            }
            else
            {
                id        = ii.Value;
                ii.Value += 1;
                dc.SubmitChanges();
            }
            return(id);
        }