//[InlineData("Sraatta", "Dupa, dupa dupa dupa.", "24.01.2019 12:35:25", PriorityEnum.Low, true,    CategoryEnum.Shopping, null)]
        //[InlineData("Sraatta", "Dupa, dupa dupa dupa.", "24.01.2019 12:35:25", PriorityEnum.Medium, true, CategoryEnum.Shopping, null)]

        //[MemberData(nameof(GetDataForTest))]
        public void InvalidPriorityRangeTest(string name, string desc, string createdAt,
                                             PriorityEnum prio, bool isDone, CategoryEnum cate, ICollection <Comment> comments)
        {
            DateTime     createdAtDate = DateTime.Parse(createdAt);
            PriorityEnum priority      = prio;
            CategoryEnum category      = cate;

            var obj = new TaskModel()
            {
                Name             = name,
                ShortDescription = desc,
                CreatedAt        = createdAtDate,
                Priority         = priority,
                IsDone           = isDone,
                Category         = category,
                Comments         = comments ?? new List <Comment>()
            };

            var objConverted = TaskModelConverter.ConvertTaskToShowAllView(obj);

            Assert.Equal(obj.Name, objConverted.Name);
            Assert.Equal(obj.ShortDescription, objConverted.ShortDescription);

            Assert.Equal(priority, objConverted.Priority);

            Assert.Equal(obj.Comments.Count, objConverted.NumberOfComments);
        }
Ejemplo n.º 2
0
        internal async Task <int> AddTaskAsync(GrpcChannel channel,
                                               int managerId,
                                               int assignedEmployee,
                                               DateTime createDate,
                                               string description,
                                               DateTime finalDate,
                                               PriorityEnum priority,
                                               string subject)
        {
            var client = new Tasks.TasksClient(channel);
            var input  = new TaskInput
            {
                ManagerId        = managerId,
                AssignedEmployee = assignedEmployee,
                CreateDate       = createDate.Date.ToUniversalTime().ToTimestamp(),
                Description      = description,
                FinalDate        = finalDate.Date.ToUniversalTime().ToTimestamp(),
                Priority         = priority.ToString(),
                Subject          = subject
            };
            var taskId = await client.AddTaskAsync(input);

            await SendUpdateEventAsync(channel, assignedEmployee);

            return(taskId.Value);
        }
Ejemplo n.º 3
0
 public CORelease(User creator, LocationEnum origin, PriorityEnum priority, params string[] controlobjects) : this(creator, origin, priority)
 {
     foreach (var co in controlobjects)
     {
         ControlObjects.Add(new ControlObject(co));
     }
 }
Ejemplo n.º 4
0
 public TaskItem(int id, string description, PriorityEnum priority = PriorityEnum.Normal, TaskStatus status = TaskStatus.NotStarted)
 {
     Id          = id;
     Description = description;
     TaskStatus  = status;
     Priority    = priority;
 }
Ejemplo n.º 5
0
        /// <summary>
        /// This method Displays a Note
        /// </summary>
        public void DisplayNote()
        {
            // initial values
            string       title       = "";
            string       description = "";
            PriorityEnum priority    = PriorityEnum.Normal;
            int          noteId      = 0;

            // if the object exists
            if (this.HasNote)
            {
                // set the values
                title       = Note.Title;
                description = Note.Description;
                priority    = Note.Priority;
                noteId      = Note.Id;
            }

            // display the values
            this.TitleControl.Text             = title;
            this.DescriptionControl.Text       = description;
            this.PriorityControl.SelectedIndex = PriorityControl.FindItemIndexByValue(priority.ToString());
            this.IdControl.Text = noteId.ToString();

            // display the note in the Note Editor
            this.Text = "Note Editor - " + noteId;
        }
Ejemplo n.º 6
0
        private void TapGestureRecognizer_OnTapped(object sender, EventArgs e)
        {
            var stacks = SlPriorities.Children;

            foreach (var stack in stacks)
            {
                if ((stack as StackLayout)?.Children[1] is Label lblPriority)
                {
                    lblPriority.TextColor = Color.Gray;
                }
            }

            ((Label)((StackLayout)sender).Children[1]).TextColor = Color.Black;
            var source = ((Image)((StackLayout)sender).Children[0]).Source as FileImageSource;

            if (source == null)
            {
                return;
            }
            var priority = source.File.Replace("Resources/", "").Replace(".png", "");

            Enum.TryParse(CultureInfo.CurrentCulture.TextInfo.ToTitleCase(priority.ToLower()),
                          out PriorityEnum parsedEnum);
            Priority = parsedEnum;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// This method returns the Priority
        /// </summary>
        public PriorityEnum ParsePriority(int priorirtyIndex)
        {
            // initial value
            PriorityEnum priority = PriorityEnum.Normal;

            // set the value
            switch (priorirtyIndex)
            {
            case 0:

                // set the value
                priority = PriorityEnum.Low;

                // required
                break;

            case 2:

                // set the value
                priority = PriorityEnum.High;

                // required
                break;
            }

            // return value
            return(priority);
        }
Ejemplo n.º 8
0
 public void Enqueue(T job, PriorityEnum priority)
 {
     lock (_locker)
     {
         _jobs[priority].Enqueue(job);
     }
 }
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.Vocalization                  = binaryReader.ReadStringID();
     this.ParentVocalization            = binaryReader.ReadStringID();
     this.ParentIndex                   = binaryReader.ReadInt16();
     this.Priority                      = ((PriorityEnum)(binaryReader.ReadInt16()));
     this.VocalizationDefinitions2Flags = ((Flags)(binaryReader.ReadInt32()));
     this.GlanceBehavior                = ((GlanceBehaviorEnum)(binaryReader.ReadInt16()));
     this.GlanceRecipientBehavior       = ((GlanceRecipientBehaviorEnum)(binaryReader.ReadInt16()));
     this.PerceptionType                = ((PerceptionTypeEnum)(binaryReader.ReadInt16()));
     this.MaxCombatStatus               = ((MaxCombatStatusEnum)(binaryReader.ReadInt16()));
     this.AnimationImpulse              = ((AnimationImpulseEnum)(binaryReader.ReadInt16()));
     this.OverlapPriority               = ((OverlapPriorityEnum)(binaryReader.ReadInt16()));
     this.SoundRepetitionDelay          = binaryReader.ReadSingle();
     this.AllowableQueueDelay           = binaryReader.ReadSingle();
     this.PreVocDelay                   = binaryReader.ReadSingle();
     this.NotificationDelay             = binaryReader.ReadSingle();
     this.PostVocDelay                  = binaryReader.ReadSingle();
     this.RepeatDelay                   = binaryReader.ReadSingle();
     this.Weight             = binaryReader.ReadSingle();
     this.SpeakerFreezeTime  = binaryReader.ReadSingle();
     this.ListenerFreezeTime = binaryReader.ReadSingle();
     this.SpeakerEmotion     = ((SpeakerEmotionEnum)(binaryReader.ReadInt16()));
     this.ListenerEmotion    = ((ListenerEmotionEnum)(binaryReader.ReadInt16()));
     this.PlayerSkipFraction = binaryReader.ReadSingle();
     this.SkipFraction       = binaryReader.ReadSingle();
     this.SampleLine         = binaryReader.ReadStringID();
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(12));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(96));
     return(pointerQueue);
 }
Ejemplo n.º 10
0
 public Note(string name, string text, PriorityEnum priority)
 {
     this.Name     = name;
     this.Text     = text;
     this.Priority = priority;
     this.Added    = DateTime.Now.ToString(Note.DateTimeFormat);
 }
Ejemplo n.º 11
0
 public DefectAttribute(PriorityEnum priority, SeverityEnum severity, string description = "", params string [] steps)
 {
     this.Priority    = priority;
     this.Severity    = severity;
     this.Description = description;
     this.Steps       = steps;
 }
Ejemplo n.º 12
0
 /// <summary>
 ///
 /// </summary>
 public TracerItem(TypeEnum itemType, DateTime time, PriorityEnum priority, string message)
 {
     _priority  = priority;
     _fullType  = itemType;
     _itemTypes = GeneralHelper.GetCombinedEnumValues(itemType).ToArray();
     _dateTime  = time;
     _message   = message;
 }
Ejemplo n.º 13
0
 /// <summary>
 /// 
 /// </summary>
 public TracerItem(TypeEnum itemType, DateTime time, PriorityEnum priority, string message)
 {
     _priority = priority;
     _fullType = itemType;
     _itemTypes = GeneralHelper.GetCombinedEnumValues(itemType).ToArray();
     _dateTime = time;
     _message = message;
 }
Ejemplo n.º 14
0
 public Message(string title, string body, PriorityEnum priority, IPAddress destination, int version)
 {
     m_Version   = 1;
     Title       = title;
     Body        = body;
     Priority    = priority;
     Destination = destination;
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Inicialize connector
 /// inicialize note to edit
 /// </summary>
 /// <param name="connector"></param>
 /// <param name="note"></param>
 public AddNoteVM(DbConnector connector, Note note)
     : this(connector)
 {
     this.note     = note;
     this.Text     = note.Text;
     this.Name     = note.Name;
     this.Priority = note.Priority;
 }
Ejemplo n.º 16
0
 /// <summary>
 /// 
 /// </summary>
 public TracerItem(TypeEnum itemType, PriorityEnum priority, string message)
 {
     _priority = priority;
     _fullType = itemType;
     _itemTypes = GeneralHelper.GetCombinedEnumValues(itemType).ToArray();
     _dateTime = DateTime.Now;
     _applicationTick = GeneralHelper.ApplicationStopwatchTicks;
     _message = message;
 }
Ejemplo n.º 17
0
 /// <summary>
 ///
 /// </summary>
 public TracerItem(TypeEnum itemType, PriorityEnum priority, string message)
 {
     _priority        = priority;
     _fullType        = itemType;
     _itemTypes       = GeneralHelper.GetCombinedEnumValues(itemType).ToArray();
     _dateTime        = DateTime.Now;
     _applicationTick = GeneralHelper.ApplicationStopwatchTicks;
     _message         = message;
 }
Ejemplo n.º 18
0
 public static IEnumerable <SelectListItem> GetPrioritySelect(PriorityEnum id)
 {
     return(Enum.GetValues(typeof(PriorityEnum))
            .Cast <PriorityEnum>()
            .Select(x => new SelectListItem
     {
         Text = x.ToString(),
         Value = ((int)x).ToString(),
         Selected = x == id
     }));
 }
        public ActionResult ChangePriority(PriorityEnum newPriority, int relatedOpportunityId)
        {
            var opportunity = _db.Educations.First(o => o.Id == relatedOpportunityId);

            opportunity.Priority      = newPriority;
            opportunity.UpdateDate    = DateTime.Now;
            opportunity.LastUpdatedBy = User.Identity.Name;
            _db.SaveChanges();

            return(Redirect(Request.UrlReferrer?.ToString()));
        }
Ejemplo n.º 20
0
        public ActionResult ChangePriority(PriorityEnum newPriority, int relatedLeadId)
        {
            var lead = _db.Leads.First(l => l.LeadId == relatedLeadId);

            lead.Priority      = newPriority;
            lead.UpdateDate    = DateTime.Now;
            lead.LastUpdatedBy = User.Identity.Name;
            _db.SaveChanges();

            return(Redirect(Request.UrlReferrer?.ToString()));
        }
Ejemplo n.º 21
0
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.Type             = ((TypeEnum)(binaryReader.ReadInt16()));
     this.Priority         = ((PriorityEnum)(binaryReader.ReadInt16()));
     this.Duration         = binaryReader.ReadSingle();
     this.FadeFunction     = ((FadeFunctionEnum)(binaryReader.ReadInt16()));
     this.fieldpad         = binaryReader.ReadBytes(2);
     this.MaximumIntensity = binaryReader.ReadSingle();
     this.Color            = binaryReader.ReadVector4();
     return(pointerQueue);
 }
Ejemplo n.º 22
0
        public NotificatorClientDTO(string clientName, int projectId, string projectName, PriorityEnum priority,
            TypeEnum type, string shortDescription, string detailedDescription)
        {
            ClientName = clientName;

            ProjectId = projectId;
            ProjectName = projectName;

            Priority = priority;
            Type = type;
            ShortDescription = shortDescription;
            DetailedDescription = detailedDescription;
        }
Ejemplo n.º 23
0
        public void AddTask(string taskString, PriorityEnum priority, uint assignedTo, uint assignedBy, DateTime assignedDate, DateTime dueDate)
        {
            ZTask addTask = new ZTask
            {
                TaskName     = taskString,
                AssignedTo   = assignedTo,
                AssignedBy   = assignedBy,
                AssignedDate = assignedDate,
                DueDate      = dueDate,
                Priority     = priority
            };

            TaskList.Add(addTask);
        }
Ejemplo n.º 24
0
        /// <summary>
        /// method returns the
        /// </summary>
        public Point Add(NoteControl noteControl, PriorityEnum priority)
        {
            // initial value
            Point point = new Point(0, 0);

            // Determine the action by the priority
            switch (priority)
            {
            case PriorityEnum.High:

                // Add this item
                this.HighPriorityItems.Add(noteControl);

                // set the x and y
                point.X = LeftStart + ((HighPriorityItems.Count - 1) * ControlSpacing);
                point.Y = HighPrioirityRow;

                // required
                break;

            case PriorityEnum.Normal:

                // Add to NormalPriorityItems
                NormalPriorityItems.Add(noteControl);

                // set the x and y
                point.X = LeftStart + ((NormalPriorityItems.Count - 1) * ControlSpacing);
                point.Y = NormalPrioirityRow;

                // required
                break;

            case PriorityEnum.Low:

                // Add to LowPriorityItems
                LowPriorityItems.Add(noteControl);

                // set the x and y
                point.X = LeftStart + ((LowPriorityItems.Count - 1) * ControlSpacing);
                point.Y = LowPrioirityRow;

                // required
                break;
            }

            // return value
            return(point);
        }
Ejemplo n.º 25
0
 public Issue(User reportedBy, PriorityEnum priority, Project project, CategoryEnum category, Component component, ProductVersion version, Resolution resolution,
              string summary, string description, string environment, User assignedTo, DateTime dueDate, SortedSetAny <Attachment> attachments, StatusEnum status = StatusEnum.Open)
 {
     if (attachments != null)
     {
         this.attachments = attachments;
     }
     else
     {
         this.attachments = new SortedSetAny <Attachment>();
     }
     this.reportedBy      = reportedBy;
     this.project         = project;
     this.component       = component;
     affectedComponentSet = new SortedSetAny <Component>(1);
     if (component != null)
     {
         affectedComponentSet.Add(component);
     }
     affectedVersionSet = new SortedSetAny <ProductVersion>(1);
     if (version != null)
     {
         affectedVersionSet.Add(version);
     }
     voteSet             = new SortedSetAny <Vote>(1);
     relatedIssueSet     = new SortedSetAny <Issue>(1);
     fixedInVersionSet   = new SortedSetAny <ProductVersion>(1);
     subTaskSet          = new SortedSetAny <SubTask>(1);
     labelSet            = new SortedSetAny <ProductLabel>(1);
     this.version        = version;
     this.summary        = summary;
     this.description    = description;
     this.environment    = environment;
     this.category       = category;
     this.priority       = priority;
     fixResolution       = resolution;
     dateTimeCreated     = DateTime.Now;
     dateTimeLastUpdated = dateTimeCreated;
     fixmessage          = null;
     lastUpdatedBy       = reportedBy;
     this.dueDate        = dueDate;
     this.status         = status;
     this.AssignedTo     = assignedTo;
     subscribers         = null; // to do
     testCase            = null; // to do
 }
Ejemplo n.º 26
0
 public Issue(User reportedBy, PriorityEnum priority, Project project, CategoryEnum category, Component component, ProductVersion version, Resolution resolution,
              string summary, string description, string environment, User assignedTo, DateTime dueDate, SortedSetAny <Attachment> attachments, StatusEnum status = StatusEnum.Open)
 {
     if (attachments != null)
     {
         m_attachments = attachments;
     }
     else
     {
         m_attachments = new SortedSetAny <Attachment>();
     }
     m_reportedBy           = reportedBy;
     m_project              = project;
     m_component            = component;
     m_affectedComponentSet = new SortedSetAny <Component>(1);
     if (component != null)
     {
         m_affectedComponentSet.Add(component);
     }
     m_affectedVersionSet = new SortedSetAny <ProductVersion>(1);
     if (version != null)
     {
         m_affectedVersionSet.Add(version);
     }
     m_voteSet             = new SortedSetAny <Vote>(1);
     m_relatedIssueSet     = new SortedSetAny <Issue>(1);
     m_fixedInVersionSet   = new SortedSetAny <ProductVersion>(1);
     m_subTaskSet          = new SortedSetAny <SubTask>(1);
     m_labelSet            = new SortedSetAny <ProductLabel>(1);
     m_version             = version;
     m_summary             = summary;
     m_description         = description;
     m_environment         = environment;
     m_category            = category;
     m_priority            = priority;
     m_fixResolution       = resolution;
     m_dateTimeCreated     = DateTime.Now;
     m_dateTimeLastUpdated = m_dateTimeCreated;
     m_fixmessage          = null;
     m_lastUpdatedBy       = reportedBy;
     m_dueDate             = dueDate;
     m_status      = status;
     AssignedTo    = assignedTo;
     m_subscribers = null; // to do
     m_testCase    = null; // to do
 }
Ejemplo n.º 27
0
        /// <summary>
        /// Save or Edit note and save changes to database
        /// </summary>
        public void SaveChanges()
        {
            using (NoterDbContext db = this.connector.GetContext())
            {
                if (this.note != null)
                {
                    this.note.Name            = this.Name;
                    this.note.Text            = this.Text;
                    this.note.Priority        = this.Priority;
                    this.note.Edited          = DateTime.Now.ToString(Note.DateTimeFormat);
                    db.Entry(this.note).State = System.Data.Entity.EntityState.Modified;
                }
                else
                {
                    Note newNote = new Note(this.Name, this.Text, this.Priority);
                    db.Notes.Add(newNote);
                }

                db.SaveChanges();
            }
        }
Ejemplo n.º 28
0
        public async Task <int> AddTaskAsync(int managerId,
                                             int assignedEmployee,
                                             DateTime createDate,
                                             string description,
                                             DateTime finalDate,
                                             PriorityEnum priority,
                                             string subject)
        {
            var channel = GetChannel();
            var taskId  = await _tasksApi.AddTaskAsync(channel,
                                                       managerId,
                                                       assignedEmployee,
                                                       createDate,
                                                       description,
                                                       finalDate,
                                                       priority,
                                                       subject);

            await channel.ShutdownAsync();

            return(taskId);
        }
Ejemplo n.º 29
0
 public SubscribeRule(
     [JsonProperty("type")]
     TypeEnum type,
     [JsonProperty("all")]
     bool?all,
     [JsonProperty("publisher")]
     string publisher,
     [JsonProperty("track")]
     string track,
     [JsonProperty("kind")]
     KindEnum kind,
     [JsonProperty("priority")]
     PriorityEnum priority
     )
 {
     Type      = type;
     All       = all;
     Kind      = kind;
     Priority  = priority;
     Publisher = publisher;
     Track     = track;
 }
Ejemplo n.º 30
0
 public Issue(User reportedBy, PriorityEnum priority, Project project, CategoryEnum category, Component component, ProductVersion version, Resolution resolution,
   string summary, string description, string environment, User assignedTo, DateTime dueDate, SortedSetAny<Attachment> attachments, StatusEnum status = StatusEnum.Open)
 {
   if (attachments != null)
     m_attachments = attachments;
   else
     m_attachments = new SortedSetAny<Attachment>();
   m_reportedBy = reportedBy;
   m_project = project;
   m_component = component;
   m_affectedComponentSet = new SortedSetAny<Component>(1);
   if (component != null)
     m_affectedComponentSet.Add(component);
   m_affectedVersionSet = new SortedSetAny<ProductVersion>(1);
   if (version != null)
     m_affectedVersionSet.Add(version);
   m_voteSet = new SortedSetAny<Vote>(1);
   m_relatedIssueSet = new SortedSetAny<Issue>(1);
   m_fixedInVersionSet = new SortedSetAny<ProductVersion>(1);
   m_subTaskSet = new SortedSetAny<SubTask>(1);
   m_labelSet = new SortedSetAny<ProductLabel>(1);
   m_version = version;
   m_summary = summary;
   m_description = description;
   m_environment = environment;
   m_category = category;
   m_priority = priority;
   m_fixResolution = resolution;
   m_dateTimeCreated = DateTime.Now;
   m_dateTimeLastUpdated = m_dateTimeCreated;
   m_fixmessage = null;
   m_lastUpdatedBy = reportedBy;
   m_dueDate = dueDate;
   m_status = status;
   AssignedTo = assignedTo;
   m_subscribers = null; // to do
   m_testCase = null;// to do
 }
Ejemplo n.º 31
0
 public Issue(User reportedBy, PriorityEnum priority, Project project, CategoryEnum category, Component component, ProductVersion version, Resolution resolution,
   string summary, string description, string environment, User assignedTo, DateTime dueDate, SortedSetAny<Attachment> attachments, StatusEnum status = StatusEnum.Open)
 {
   if (attachments != null)
     this.attachments = attachments;
   else
     this.attachments = new SortedSetAny<Attachment>();
   this.reportedBy = reportedBy;
   this.project = project;
   this.component = component;
   affectedComponentSet = new SortedSetAny<Component>(1);
   if (component != null)
     affectedComponentSet.Add(component);
   affectedVersionSet = new SortedSetAny<ProductVersion>(1);
   if (version != null)
     affectedVersionSet.Add(version);
   voteSet = new SortedSetAny<Vote>(1);
   relatedIssueSet = new SortedSetAny<Issue>(1);
   fixedInVersionSet = new SortedSetAny<ProductVersion>(1);
   subTaskSet = new SortedSetAny<SubTask>(1);
   labelSet = new SortedSetAny<ProductLabel>(1);
   this.version = version;
   this.summary = summary;
   this.description = description;
   this.environment = environment;
   this.category = category;
   this.priority = priority;
   fixResolution = resolution;
   dateTimeCreated = DateTime.Now;
   dateTimeLastUpdated = dateTimeCreated;
   fixmessage = null;
   lastUpdatedBy = reportedBy;
   this.dueDate = dueDate;
   this.status = status;
   this.AssignedTo = assignedTo;
   subscribers = null; // to do
   testCase = null;// to do
 }
 private static ClassEnum GetClassByScore(IUCNCategoryEnum a_Category, PriorityEnum a_Priority, int a_Score)
 {
     if (a_Category.IsOneOf(IUCNCategoryEnum.NotEvaluated, IUCNCategoryEnum.DataDeficient) || a_Priority == PriorityEnum.DataDeficientNotEvaluated)
     {
         return(ClassEnum.DataDeficientNotEvaluated);
     }
     if (a_Score.IsOneOf(2, 3, 6, 7, 8, 9))
     {
         return(ClassEnum.Class4);
     }
     if (a_Score.IsOneOf(10, 11, 12))
     {
         return(ClassEnum.Class3);
     }
     if (a_Score.IsOneOf(13, 14, 15, 16, 17, 18))
     {
         return(ClassEnum.Class2);
     }
     if (a_Score.IsOneOf(20, 22, 25))
     {
         return(ClassEnum.Class1);
     }
     return(ClassEnum.DataDeficientNotEvaluated);
 }
Ejemplo n.º 33
0
 /// <summary>
 /// Gets the enum value description
 /// </summary>
 /// <param name="priority">The priority</param>
 /// <returns>The enum value description</returns>
 public static string GetDescription(this PriorityEnum priority)
 {
     return(EnumHelper.GetDescriptionAttributeValue(priority));
 }
Ejemplo n.º 34
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="enumerable"></param>
        /// <param name="dtInRange"></param>
        /// <returns></returns>
        public bool HasInRange(IEnumerable<DateTime> enumerable, PriorityEnum priority, out DateTime dtInRange)
        {
            dtInRange = DateTime.MinValue;

            IEnumerable<DateTime> r = this.GetInRange(enumerable);
            bool has = r.Count() > 0;
            if (has)
            {
                dtInRange = priority == PriorityEnum.PriorityFirst ? r.First() : r.Last();
            }

            return has;
        }
Ejemplo n.º 35
0
        public static void AddPlayer(string PlayerName, Command cmd, PriorityEnum priority, SWGoH.Enums.QueueEnum.QueueType type, DateTime nextrundate)
        {
            try
            {
                MongoDBRepo    mongo = new MongoDBRepo();
                IMongoDatabase db    = mongo.Connect();
                if (db != null)
                {
                    IMongoCollection <QueueDto> collection = db.GetCollection <QueueDto>("Queue");
                    if (collection != null)
                    {
                        FilterDefinition <QueueDto> filter = Builders <QueueDto> .Filter.Eq("Name", PlayerName);

                        UpdateDefinition <QueueDto> update = Builders <QueueDto> .Update.Set("Name", PlayerName)
                                                             .Set("InsertedDate", DateTime.UtcNow.ToString("o"))
                                                             .Set("ProcessingStartDate", "")
                                                             .Set("NextRunDate", nextrundate.ToString("o"))
                                                             .Set("Status", SWGoH.Enums.QueueEnum.QueueStatus.PendingProcess)
                                                             .Set("Priority", priority)
                                                             .Set("Type", type)
                                                             .Set("Command", cmd)
                                                             .Set("ComputerName", "");

                        var opts = new FindOneAndUpdateOptions <QueueDto>()
                        {
                            IsUpsert       = true,
                            ReturnDocument = ReturnDocument.After,
                            Sort           = Builders <QueueDto> .Sort.Descending(r => r.Priority).Ascending(r => r.NextRunDate)
                        };
                        QueueDto found = collection.FindOneAndUpdate <QueueDto>(filter, update, opts);
                        if (found != null)
                        {
                            SWGoH.Log.ConsoleMessage("Added Player To Queu:" + PlayerName);
                        }
                    }
                }
                else
                {
                    using (HttpClient client = new HttpClient())
                    {
                        JObject data = new JObject(
                            new JProperty("Name", PlayerName),
                            new JProperty("InsertedDate", DateTime.UtcNow.ToString("o")),
                            new JProperty("ProcessingStartDate", ""),
                            new JProperty("NextRunDate", nextrundate.ToString("o")),
                            new JProperty("Status", SWGoH.Enums.QueueEnum.QueueStatus.PendingProcess),
                            new JProperty("Priority", priority),
                            new JProperty("Type", type),
                            new JProperty("Command", cmd),
                            new JProperty("ComputerName", ""));

                        var httpContent = new StringContent(data.ToString(), Encoding.UTF8, "application/json");
                        var requestUri  = string.Format(SWGoH.MongoDBRepo.BuildApiUrl("Queue", "", "", "", ""));
                        HttpResponseMessage response = client.PostAsync(requestUri, httpContent).Result;
                        if (response.IsSuccessStatusCode)
                        {
                            SWGoH.Log.ConsoleMessage("Added Player To Queu:" + PlayerName);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                SWGoH.Log.ConsoleMessage("Error Adding Player To Queu:" + e.Message);
            }
        }
Ejemplo n.º 36
0
 public static String GetByKey(PriorityEnum key)
 {
     return Container[key];
 }
 private static byte GetScoreByCategoryAndPriority(IUCNCategoryEnum a_Category, PriorityEnum a_Priority)
 {
     return((byte)(a_Category.GetEnumScore() + a_Priority.GetEnumScore()));
 }