public void SimpleWorkerFactoryParsingTest(WorkerSpecification workerSpecs, Model.Worker expectedWorker)
        {
            var parser = new WorkerFactory();
            var actualTask = parser.MakeWorker(workerSpecs);

            Assert.IsTrue(expectedWorker.Equals(actualTask));
        }
        public void SimpleTaskFactoryParsingTest(TaskSpecification taskSpecs, Model.Task expectedTask)
        {
            var parser = new TaskFactory();
            var actualTask = parser.MakeTask(taskSpecs);

            Assert.IsTrue(expectedTask.Equals(actualTask));
        }
        public void MisplacedTaskSpecExtractionAndTaskFactoryParsingTest(int entry, Model.Task expectedTask)
        {
            ws = (Excel.Worksheet)wss["TestTasks2"];

            IEnumerable<Specification> actualTaskSpecs;
            Assert.IsTrue(excelController.ExtractData(out actualTaskSpecs));

            var parser = new TaskFactory();
            var actualTask = parser.MakeTasks(actualTaskSpecs.OfType<TaskSpecification>().ToList());

            Assert.IsTrue(expectedTask.Equals(actualTask.ElementAt(entry)));
        }
Example #4
0
		public static void Enable(Usr CurrentUsr, int ParentObjectK, Model.Entities.ObjectType ParentObjectType)
		{
			if (ParentObjectType.Equals(Model.Entities.ObjectType.Thread))
			{
				Thread t = new Thread(ParentObjectK);
				bool changed = false;
				if (t.CheckPermissionRead(CurrentUsr))
				{
					ThreadUsr tu = t.GetThreadUsr(CurrentUsr);

					if (!tu.IsWatching)
					{
						tu.ChangeStatus(ThreadUsr.StatusEnum.Archived, true);
						changed = true;
					}

					if (changed)
					{
						UpdateTotalParticipantsJob job = new UpdateTotalParticipantsJob();
						job.ExecuteAsynchronously();
					}
				}
				return;
			}

			try
			{
				CommentAlert c = new CommentAlert(CurrentUsr.K, ParentObjectType, ParentObjectK);
			}
			catch
			{
				CommentAlert c = new CommentAlert();
				c.UsrK = CurrentUsr.K;
				c.ParentObjectK = ParentObjectK;
				c.ParentObjectType = ParentObjectType;
				c.Update();
			}
		}
Example #5
0
        /// <summary>
        /// ����ijһ����ָ��Id�ķ���
        /// </summary>
        /// <param name="sortType"></param>
        /// <param name="sortId"></param>
        /// <returns></returns>
        public static int UpdateInfoCount(Model.SortType sortType, long sortId)
        {
            string sortFlagName = GetSortFlagName(sortType);

            if (sortType.Equals("")) return 0;

            if (sortId <= 0) return 0;

            return DAL.UpdateInfoCount(sortFlagName, sortId);
        }
Example #6
0
		public static bool CanBeConnectedToStatic(Model.Entities.ObjectType o)
		{
			if (o.Equals(Model.Entities.ObjectType.Place))
				return true;

			if (Place.CanBeConnectedToStatic(o))
				return true;

			return false;
		}
Example #7
0
		public bool IsConnectedTo(Model.Entities.ObjectType objectType, int objectK)
		{
			if (objectType.Equals(Model.Entities.ObjectType.Venue) && this.K == objectK)
				return true;

			if (objectType.Equals(Model.Entities.ObjectType.Place) && this.PlaceK == objectK)
				return true;

			if (Place.CanBeConnectedToStatic(objectType) && this.Place.IsConnectedTo(objectType, objectK))
				return true;

			return false;

		}
Example #8
0
		public static bool IsEnabled(int UsrK, int ParentObjectK, Model.Entities.ObjectType ParentObjectType)
		{
			if (ParentObjectType.Equals(Model.Entities.ObjectType.Thread))
			{
				try
				{
					ThreadUsr tu = new ThreadUsr(ParentObjectK, UsrK);
					return tu.IsWatching;
				}
				catch
				{
					return false;
				}
			}

			try
			{
				CommentAlert c = new CommentAlert(UsrK, ParentObjectType, ParentObjectK);
				return true;
			}
			catch
			{
				return false;
			}
		}
Example #9
0
		public bool IsConnectedTo(Model.Entities.ObjectType objectType, int objectK)
		{
			if (objectType.Equals(Model.Entities.ObjectType.Thread) && this.K == objectK)
				return true;

			if (this.ParentDiscussable is IConnectedTo)
			{
				IConnectedTo parent = (IConnectedTo)this.ParentDiscussable;

				if (objectType.Equals(this.ParentObjectType) && this.ParentObjectK == objectK)
					return true;

				if (parent.CanBeConnectedTo(objectType) && parent.IsConnectedTo(objectType, objectK))
					return true;
			}

			return false;
		}