示例#1
0
 public static void SetActive(string tsbId)
 {
     lock (sync)
     {
         // inactive all TSBs
         string cmd = string.Empty;
         cmd += "UPDATE TSB ";
         cmd += "   SET Active = 0";
         NQuery.Execute(cmd);
         // Set active TSB
         cmd  = string.Empty;
         cmd += "UPDATE TSB ";
         cmd += "   SET Active = 1 ";
         cmd += " WHERE TSBId = ? ";
         NQuery.Execute(cmd, tsbId);
     }
 }
示例#2
0
        /// <summary>
        /// Set Active by TSB Id.
        /// </summary>
        /// <param name="tsbId">The TSB Id.</param>
        /// <returns>Returns Set Active status.</returns>
        public static NDbResult SetActive(string tsbId)
        {
            var result          = new NDbResult();
            SQLiteConnection db = Default;

            if (null == db)
            {
                result.DbConenctFailed();
                return(result);
            }
            lock (sync)
            {
                MethodBase med = MethodBase.GetCurrentMethod();
                try
                {
                    // inactive all TSBs
                    string cmd = string.Empty;
                    cmd += "UPDATE TSB ";
                    cmd += "   SET Active = 0";
                    NQuery.Execute(cmd);
                    // Set active TSB
                    cmd  = string.Empty;
                    cmd += "UPDATE TSB ";
                    cmd += "   SET Active = 1 ";
                    cmd += " WHERE TSBId = ? ";
                    NQuery.Execute(cmd, tsbId);
                    result.Success();
                }
                catch (Exception ex)
                {
                    med.Err(ex);
                    result.Error(ex);
                }
                return(result);
            }
        }