Example #1
0
 private void Log(DateTime dateTime, int i, string funcName)
 {
     for (int j = 0; j < 1000; ++j)
     {
         ABSMgrConnDB db  = ABSMgrConnDB.GetInstance();
         UserLog      log = new UserLog();
         log.TimeStampUserName = "******";
         log.ProjectId         = -1;
         log.TimeStamp         = dateTime;
         log.LogTypeId         = 1;
         log.Comment           = "ParallelLogTest-ParallelAddLog-" + i.ToString();
         log.Description       = funcName;
         db.Insert(log.GetTableObject());
     }
 }
Example #2
0
        public static string GetGuidById(int id, string tableName, string idColumnName)
        {
            var db = ABSMgrConnDB.GetInstance();

            if (!idColumnName.EndsWith("_id"))
            {
                throw new ApplicationException("id column name doesn't match the rule: ends with _id");
            }
            var guidColumn = idColumnName.Substring(0, idColumnName.Length - 3) + "_guid";
            var rt         = db.FirstOrDefault <string>("select top 1 " + guidColumn + " from "
                                                        + tableName
                                                        + " where "
                                                        + idColumnName + " = @0"
                                                        , id);

            return(rt);
        }
Example #3
0
        public static int GetIdByGuid(string guid, string tableName, string guidColumnName)
        {
            guidColumnName = guidColumnName.ToLower();
            var db = ABSMgrConnDB.GetInstance();

            if (!guidColumnName.EndsWith("_guid"))
            {
                throw new ApplicationException("guid column name doesn't match the rule: ends with _guid");
            }
            var idColumn = guidColumnName.Substring(0, guidColumnName.Length - 5) + "_id";
            var rt       = db.FirstOrDefault <int>("select top 1 " + idColumn + " from "
                                                   + tableName
                                                   + " where "
                                                   + guidColumnName + " = @0"
                                                   , guid);

            return(rt);
        }
Example #4
0
        private void LogUseTask(DateTime dateTime, int i, string funcName)
        {
            ABSMgrConnDB db   = ABSMgrConnDB.GetInstance();
            var          task = new System.Threading.Tasks.Task(new Action(() =>
            {
                for (int j = 0; j < 1000; ++j)
                {
                    UserLog log           = new UserLog();
                    log.TimeStampUserName = "******";
                    log.ProjectId         = -1;
                    log.TimeStamp         = dateTime;
                    log.LogTypeId         = 1;
                    log.Comment           = "ParallelLogTest-ParallelAddLog-" + i.ToString();
                    log.Description       = funcName;
                    db.Insert(log.GetTableObject());
                }
            }));

            task.Start();
            m_taskList.Add(task);
        }