Exemple #1
0
    public string DeleteBatch(string id)
    {
        Batch b = new Batch(id);

        CbstHelper.FeedLog("Batch script has been deleted: " + b.BATCH_NAME);
        Batch.DeleteBatch(id);
        return("OK");
    }
Exemple #2
0
    public string SetBatchName(string id, string text)
    {
        Batch b = new Batch(id);

        b.BATCH_NAME = text;
        b.Store();
        CbstHelper.FeedLog("Batch script has been changed: " + b.BATCH_NAME);
        return("OK");
    }
Exemple #3
0
    public void DelM(string machine)
    {
        BstHost h = new BstHost(machine)
        {
            INACTIVE = true
        };

        h.Store();
        CbstHelper.FeedLog("Machine was deleted: " + machine);
    }
Exemple #4
0
 public static void CommentTestRuns(string ids, string comment)
 {
     string[] sids = ids.Split(',');
     foreach (string id in sids)
     {
         TestRun tr = new TestRun(id)
         {
             USERID = CurrentContext.UserID.ToString(), COMMENT = comment
         };
         tr.Store();
     }
     CbstHelper.FeedLog("Following tests where commented: " + ids);
 }
Exemple #5
0
 public static void VerifyTestRun(string ids)
 {
     string[] sids = ids.Split(',');
     foreach (string id in sids)
     {
         TestRun tr = new TestRun(id)
         {
             USERID = CurrentContext.UserID.ToString(), COMMENT = "verified", VERIFIED_USER_ID = CurrentContext.UserID.ToString()
         };
         tr.Store();
     }
     CbstHelper.FeedLog("Following tests where marked as verified: " + ids);
 }
Exemple #6
0
 public static void IgnoreTestRun(string ids)
 {
     string[] sids = ids.Split(',');
     foreach (string id in sids)
     {
         TestRun tr = new TestRun(id)
         {
             USERID = CurrentContext.UserID.ToString(), COMMENT = "ignored", IGNORE = true.ToString()
         };
         tr.Store();
     }
     CbstHelper.FeedLog("Following tests where marked as ignored: " + ids);
 }
Exemple #7
0
    public void UpdateHost(string host, bool start, string comment)
    {
        BstHost h = new BstHost(host);

        if (start)
        {
            h.POWERON = true;
        }
        else
        {
            h.POWEROFF = true;
        }
        h.Store();
        CbstHelper.FeedLog(comment);
    }
Exemple #8
0
    public void UpdateMachineCommand(string machine, CbstHelper.ThosterStatus com, string comment)
    {
        object o = CbstHelper.GetValue("SELECT ACTIONFLAG FROM PCS WHERE PCNAME='" + machine + "'");
        int    iThosterStatus = 0;

        if (o != DBNull.Value)
        {
            iThosterStatus = Convert.ToInt32(o);
        }
        CbstHelper.ThosterStatus ActionFlag = (CbstHelper.ThosterStatus)iThosterStatus;
        if ((ActionFlag & com) == 0)
        {
            ActionFlag |= com;
            CbstHelper.SQLExecute("DELETE FROM SCHEDULE WHERE LOCKEDBY = (SELECT P.ID FROM PCS P WHERE P.PCNAME = '" + machine + "');");
            CbstHelper.SQLExecute("UPDATE PCS SET ACTIONFLAG = " + (int)ActionFlag + " WHERE PCNAME = '" + machine + "';");
        }
        CbstHelper.FeedLog(comment);
    }
Exemple #9
0
    public List <string> commitChangedFiles(string key, List <int> indexes, string comment, int runID)
    {
        if (!CurrentContext.Admin)
        {
            return(new List <string>(new string[] { "Access Denied" }));
        }

        List <string> output = ChangesContainer.Commit(key, indexes, comment, CurrentContext.GitUser);

        TestRun tr = new TestRun(runID.ToString())
        {
            USERID = CurrentContext.UserID.ToString(), COMMENT = comment
        };

        tr.AddTTID(CbstHelper.GetTTfromText(comment));
        tr.Store();

        CbstHelper.FeedLog("Etalon files have been committed to git repository: " + comment);
        return(output);
    }
Exemple #10
0
 public static void PauseOnOff(int id, int idusr)
 {
     using (var db = new BST_STATISTICSEntities())
     {
         var result = db.PCS.SingleOrDefault(b => b.ID == id);
         if (result != null)
         {
             if (result.PAUSEDBY == null)
             {
                 result.PAUSEDBY = idusr;
                 CbstHelper.FeedLog(string.Format("Machine '{0}' has been paused", result.PCNAME));
             }
             else
             {
                 result.PAUSEDBY = null;
                 CbstHelper.FeedLog(string.Format("Machine '{0}' has been resumed", result.PCNAME));
             }
             db.SaveChanges();
         }
     }
 }
Exemple #11
0
    public string StopSequence(string SEQUENCEGUID, string ThosterID)
    {
        using (DataSet ds = CbstHelper.GetDataSet(string.Format(@"
                SELECT 
	                S.[COMMAND]
	                ,R.[TTID]
	                ,P.[PCNAME]
                FROM 
	                [SCHEDULE] S 
                LEFT JOIN [PCS] P ON P.[ID] = S.[PCID]
                LEFT JOIN [TESTREQUESTS] R ON R.[ID] = S.[REQUESTID]
                WHERE 
	            S.[SEQUENCEGUID] = '{0}'
            ", SEQUENCEGUID)))
        {
            string message = "Sequence has been stopped: ";
            string machine = "";
            string ttid    = "";
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                message += dr["COMMAND"].ToString() + ",";
                machine  = dr["PCNAME"].ToString();
                ttid     = dr["TTID"].ToString();
            }

            message = message.Remove(message.Length - 1);
            CbstHelper.FeedLog(message);
            CbstHelper.FeedLog("Request has been changed: " + ttid);
            if (!string.IsNullOrEmpty(machine))
            {
                CbstHelper.FeedLog("Machine was affected: " + machine);
            }

            CbstHelper.SQLExecute("DELETE FROM SCHEDULE WHERE SEQUENCEGUID = '" + SEQUENCEGUID + "'");
            CbstHelper.SQLExecute("update PCS set ACTIONFLAG = 2 where ID = " + ThosterID);
        }
        return("OK");
    }
Exemple #12
0
    public void ChangeState(string machine)
    {
        string update = string.Format(@"
            UPDATE PCS 
            SET 
	            PAUSEDBY = CASE WHEN PAUSEDBY IS NULL THEN (SELECT ID FROM PERSONS WHERE USER_LOGIN = '******') ELSE NULL END
            WHERE 
            PCNAME = '{1}'
        ", CurrentContext.UserLogin(), machine);

        CbstHelper.SQLExecute(update);

        object o = CbstHelper.GetValue(string.Format("SELECT PAUSEDBY FROM PCS WHERE PCNAME = '{0}'", machine));

        if (o == DBNull.Value)
        {
            CbstHelper.FeedLog(string.Format("Machine '{0}' has been resumed", machine));
        }
        else
        {
            CbstHelper.FeedLog(string.Format("Machine '{0}' has been paused", machine));
        }
    }
Exemple #13
0
 public string AddBatch(string name)
 {
     CbstHelper.FeedLog("Batch script has been added: " + name);
     return(Batch.AddBatch(name).ToString());
 }
Exemple #14
0
 public void FeedLog(string str)
 {
     CbstHelper.FeedLog(str);
 }