Example #1
0
    protected override void PostStore()
    {
        if (this.IsModified())
        {
            LastGlobalModifier = DateTime.Now;
        }
        if (IsModifiedCol(_AsUser))
        {
            if (!string.IsNullOrEmpty(_reassignedFrom))
            {
                NotifyHub.NotifyPlanChange((new DefectUser(int.Parse(_reassignedFrom)).TRID));
            }

            //when task is reassigned order in new list should be changed.
            DefectBase d = new DefectBase(ID);
            if (d.ORDER != ORDER)
            {
                d.ORDER = ORDER;
                d.Store();
                return;
            }
        }

        if (!string.IsNullOrEmpty(AUSER))
        {
            NotifyHub.NotifyPlanChange((new DefectUser(int.Parse(AUSER)).TRID));
        }
        NotifyHub.NotifyDefectChange(ID);
    }
Example #2
0
	public void spendEvent(int id, int hrs)
	{
		CurrentContext.Validate();
		DefectEvent de = new DefectEvent(id);
		de.TIME = hrs.ToString();
		de.Store();
		NotifyHub.NotifyPlanChange(CurrentContext.UserID);
	}
Example #3
0
	public DefectBase startEvent(int ttid, string disp, int hrs, string date)
	{
		CurrentContext.Validate();
		DateTime dt = DateTime.ParseExact(date, IdBasedObject.defDateFormat, CultureInfo.InvariantCulture);
		int id = Defect.GetIDbyTT(ttid);
		DefectEvent.AddEventByTask(id, DefectEvent.Eventtype.worked, CurrentContext.TTUSERID, "I have worked on this task", hrs, -1, dt);
		NotifyHub.NotifyDefectChange(id);
		return ChangeDispo(ttid, disp);
	}
Example #4
0
    public static void NewRec(DateTime d, int personid, bool lastday)
    {
        AddObject(_Tabl, new string[] { _perid, _dat }, new object[] { personid, d }, "");
        if (lastday)
        {
            string update = string.Format(@"
			UPDATE {0} SET {1} =
			(SELECT TOP 1 T2.{1} FROM {0} T2 WHERE T2.{2} < ? AND T2.{3} = ? ORDER BY T2.{2} DESC)
			WHERE {2} = ? AND {3} = ?
			"            , _Tabl, _done, _dat, _perid);
            SQLExecute(update, new object[] { d, personid, d, personid });
        }
        NotifyHub.NotifyRoomChange();
    }
Example #5
0
 protected override void OnChangeColumn(string col, string val)
 {
     if (col == _stat)
     {
         DefectBase db      = new DefectBase(TTID);
         string     ttimg   = "";
         var        st      = GetBuildStatus();
         var        success = !(st == BuildStatus.failed || st == BuildStatus.cancelled);
         if (!success)
         {
             ttimg = FailImage;
         }
         NotifyHub.NotifyBuildStatusChange(ID, TTID, int.Parse(db.AUSER), STATUSTXT, ttimg);
         if (success && db.TYPE != DefectType.DbType().ToString())
         {
             var branch   = db.BRANCH.ToUpper();
             var settings = Settings.CurrentSettings;
             if (branch != "MASTER" && branch != "RELEASE" && !string.IsNullOrEmpty(settings.DATABASEPATTERN))
             {
                 var pattern   = settings.DATABASEPATTERN.ToUpper();
                 var git       = new Git(settings.WORKGITLOCATION);
                 var gitBranch = git.GetBranch(branch);
                 var commits   = gitBranch.EnumCommits(1, 100);
                 foreach (var commit in commits)
                 {
                     var files = commit.EnumFiles();
                     foreach (var file in files)
                     {
                         if (file.Name.ToUpper().Contains(pattern))
                         {
                             NotifyHub.NotifyBuildStatusChange(ID, TTID, int.Parse(db.AUSER), "Build System has detected database changes in task commit. But the task is not marked as requiring database changes. Please update the task! This is a warning message and you do not need to start the build again - only check the task!", FailImage);
                             return;
                         }
                     }
                 }
             }
         }
     }
 }
Example #6
0
    protected override void PostStore()
    {
        DefectBase db = new DefectBase(TTID);

        NotifyHub.NotifyBuildChange(ID, TTID, int.Parse(db.AUSER), STATUSTXT);
    }
 public SubscriptionController(NotifyHub hubContext)
 {
     _hubContext = hubContext;
 }
Example #8
0
        public void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            NotifyHub nh = new NotifyHub();

            nh.NotifyDateTime(DateTime.Now.ToString());
        }
Example #9
0
    public void SetTaskTestStatus(string ttid, string failed, string userphone)
    {
        try
        {
            MPSUser bsu = MPSUser.FindUserbyPhone(userphone);
            if (bsu == null)
            {
                Logger.Log($"Cannot update task {ttid} by testing system. User was not found by phone number: {userphone}");
                return;
            }

            Defect d = new Defect(ttid);
            d.SetUpdater(bsu);
            string lockguid = Guid.NewGuid().ToString();
            var    lt       = Defect.Locktask(ttid.ToString(), lockguid, bsu.ID.ToString());
            bool   locked   = lt.globallock != lockguid;
            bool   testFail;
            bool   testcancel = false;
            if (!bool.TryParse(failed, out testFail))
            {
                testcancel = true;
            }
            if (locked)
            {
                MPSUser lu = new MPSUser(lt.lockedby);
                TasksBot.SendMessage(lu.CHATID, $"You was disconnected from the task by the testing system to update task status!{Settings.CurrentSettings.GetTTAnchor(int.Parse(ttid), "disconnect.png")}");
                NotifyHub.lockTaskForceUpdatePages(int.Parse(ttid), lockguid, bsu.ID);
                lt = Defect.Locktask(ttid.ToString(), lockguid, bsu.ID.ToString());
            }
            List <DefectDispo> disp = (testcancel || testFail) ? DefectDispo.EnumTestsFailed() : DefectDispo.EnumTestsPassed();
            if (disp.Count > 0)
            {
                if (!testcancel)
                {
                    d.DISPO = disp[0].ID.ToString();
                }
                else
                {
                    d.AddMessage("Test request have been ignored", bsu.ID);
                }
                d.Store();
                Defect.UnLocktask(ttid, lt.globallock);

                if (!testcancel)
                {
                    DefectUser du = new DefectUser(d.AUSER);
                    if (du.TRID > -1)
                    {
                        MPSUser worker = new MPSUser(du.TRID);
                        string  result = "Succeeded!";
                        string  img    = "taskokay.png";
                        if (testcancel)
                        {
                            result = "Cancelled!";
                            img    = "bin.png";
                        }
                        else if (testFail)
                        {
                            result = "Failed!";
                            img    = "taskfail.png";
                        }
                        TasksBot.SendMessage(worker.CHATID, $"The task tests have been marked as BST {result} by {bsu.PERSON_NAME}{Settings.CurrentSettings.GetTTAnchor(int.Parse(ttid), img)}");
                    }
                }
            }
        }
        catch (Exception e)
        {
            Logger.Log(e);
        }
    }
 public NotificationController(NotifyHub hubContext)
 {
     _hubContext = hubContext;
 }
Example #11
0
 public static void DelRec(int id)
 {
     DeleteObject(_Tabl, id.ToString(), _pid);
     NotifyHub.NotifyRoomChange();
 }
Example #12
0
	public void delEvent(int id)
	{
		CurrentContext.Validate();
		DefectEvent.Delete(id);
		NotifyHub.NotifyPlanChange(CurrentContext.UserID);
	}