Example #1
0
        public Case GetCase(CaseId id, string[] columns)
        {
            var response = executeFogBugzApiCommand("search", new
            {
                q    = id.ToString(),
                cols = string.Join(",", columns)
            });

            CaseParser.Parse(response);
            return(CaseParser.Cases.FirstOrDefault());
        }
Example #2
0
        private static async Task ModifyCaseAsync(IEventStore store, CaseId id)
        {
            var @case = await Case.FromAsync(store, id);

            if (@case == null)
            {
                throw new InvalidOperationException($"The case with id {id} does not exist");
            }

            @case.Import("Imported Subject", "Imported Description", "TS012345", CaseStatus.WaitingForDistributor);
            @case.AssignToService();

            await @case.CommitAsync(store);
        }
Example #3
0
    public override int GetHashCode()
    {
        int hash = 1;

        if (Type != global::Request.Types.Type.Unknown)
        {
            hash ^= Type.GetHashCode();
        }
        if (volunteer_ != null)
        {
            hash ^= Volunteer.GetHashCode();
        }
        if (DonorId != 0)
        {
            hash ^= DonorId.GetHashCode();
        }
        if (Name.Length != 0)
        {
            hash ^= Name.GetHashCode();
        }
        if (Address.Length != 0)
        {
            hash ^= Address.GetHashCode();
        }
        if (Telephone.Length != 0)
        {
            hash ^= Telephone.GetHashCode();
        }
        if (Sum != 0D)
        {
            hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Sum);
        }
        if (CaseId != 0)
        {
            hash ^= CaseId.GetHashCode();
        }
        if (Substring.Length != 0)
        {
            hash ^= Substring.GetHashCode();
        }
        if (_unknownFields != null)
        {
            hash ^= _unknownFields.GetHashCode();
        }
        return(hash);
    }
        public override string ToString()
        {
            string caseIdStr;

            if (CaseId == null)
            {
                caseIdStr = "";
            }
            else
            {
                caseIdStr = CaseId.ToString();
            }

            if (CheckUId == null)
            {
                return("CaseId:" + caseIdStr + " / Stat:" + Stat + " / SiteUId:" + SiteUId + " / CaseType:" + CaseType + " / CaseUId:" + CaseUId + " / MicrotingUId:" + MicrotingUId + ".");
            }
//            if (CheckUId == "") return "CaseId:" + caseIdStr + " / Stat:" + Stat + " / SiteUId:" + SiteUId + " / CaseType:" + CaseType + " / CaseUId:" + CaseUId + " / MicrotingUId:" + MicrotingUId + ".";
            return("CaseId:" + caseIdStr + " / Stat:" + Stat + " / SiteUId:" + SiteUId + " / CaseType:" + CaseType + " / CaseUId:" + CaseUId + " / MicrotingUId:" + MicrotingUId + " / CheckId:" + CheckUId + ".");
        }
Example #5
0
        public void PostResultToTestRailUsingMileStones(Gurock.TestRail.APIClient client, Dictionary <string, Object> testResult)
        {
            string         MileStoneId = GetMileStoneId();
            IList <string> RunIds      = new List <string>();

            RunIds = GetRunIdsForProjectAndMileStone(MileStoneId);
            _testRailUtilsLog.Info("=====>>>>" + RunIds.ToString());
            _testRailUtilsLog.Info("size:=>" + RunIds.Count);
            foreach (string RunId in RunIds)
            {
                _testRailUtilsLog.Info("==>" + RunId);
                // _testRailUtilsLog.Info("&&" + RunId + "/" + TestCaseId);
                IList <string> TestCaseId = getCaseIdsForRun(RunId);
                foreach (string CaseId in TestCaseId)
                {
                    if (CaseId.Equals(GetTestCase()))
                    {
                        client.SendPost("add_result_for_case/" + RunId + "/" + CaseId + "", testResult);
                    }
                }
                _testRailUtilsLog.Info("Client Post is successfull");
            }
        }
Example #6
0
 private static async Task CreateCaseAsync(IEventStore store, CaseId id)
 {
     // Case-ec4f433b-f7e0-41b8-93cc-338d373214ab
     var @case = Case.Create(id, "The Subject", "The Description");
     await @case.CommitAsync(store);
 }
Example #7
0
 public string this[string PropName]
 {
     get
     {
         string result = "";
         if (PropName == "CaseId")
         {
             if (string.IsNullOrWhiteSpace(CaseId))
             {
                 result = "CaseId is required";
             }
             else if (CaseId.Length > 6)
             {
                 result = "Number of digit in CaseId is less then 6";
             }
             else if (CaseId.Any(x => !char.IsLetterOrDigit(x)))
             {
                 result = "CaseId just have Letter and Digit";
             }
         }
         else if (PropName == "CaseName")
         {
             if (string.IsNullOrEmpty(CaseName))
             {
                 result = "CaseName is required";
             }
             else if (CaseName.Length > 25)
             {
                 result = "Case Name must have less then 20 Character";
             }
         }
         else if (PropName == "Plaintiff")
         {
             if (string.IsNullOrEmpty(Plaintiff))
             {
                 result = "Plaintiff is required";
             }
             else if (Plaintiff.Length > 25)
             {
                 result = "Plaintiff name must have less then 25 Character";
             }
         }
         else if (PropName == "Defender")
         {
             if (string.IsNullOrWhiteSpace(Defender))
             {
                 result = "Defender is required";
             }
             else if (Defender.Length > 25)
             {
                 result = "Defender name must have less then 25 Character";
             }
         }
         else if (PropName == "OpponentLawyer")
         {
             if (string.IsNullOrWhiteSpace(OpponentLawyer))
             {
                 result = "OpponentLawyer is required";
             }
             else if (OpponentLawyer.Length > 25)
             {
                 result = "OpponentLawyer name must have less then 25 Character";
             }
         }
         else if (PropName == "CaseDiscription")
         {
             if (string.IsNullOrWhiteSpace(CaseDiscription))
             {
                 result = "CaseDiscription is required";
             }
             else if (CaseDiscription.Length > 5000)
             {
                 result = "CaseDiscription name must have less then 5000 Character";
             }
         }
         else if (PropName == "CaseType")
         {
             if (string.IsNullOrWhiteSpace(CaseType) || CaseType == "Select Case Type..")
             {
                 result = "CaseType is required";
             }
         }
         else if (PropName == "startDate")
         {
             if (startDate == null)
             {
                 result = "Starting date is required";
             }
         }
         else if (PropName == "ClientId")
         {
             if (this.ClientId == null)
             {
                 result = "Client is required";
             }
         }
         else if (PropName == "CourtId")
         {
             if (CourtId == null)
             {
                 result = "Court is required";
             }
         }
         return(result);
     }
 }
Example #8
0
        /// <summary>
        /// Executes the workflow activity.
        /// </summary>
        /// <param name="executionContext">The execution context.</param>
        protected override void Execute(CodeActivityContext executionContext)
        {
            // Create the tracing service
            ITracingService tracingService = executionContext.GetExtension <ITracingService>();

            if (tracingService == null)
            {
                throw new InvalidPluginExecutionException("Failed to retrieve tracing service.");
            }

            tracingService.Trace("Entered " + _processName + ".Execute(), Activity Instance Id: {0}, Workflow Instance Id: {1}",
                                 executionContext.ActivityInstanceId,
                                 executionContext.WorkflowInstanceId);

            // Create the context
            IWorkflowContext context = executionContext.GetExtension <IWorkflowContext>();

            if (context == null)
            {
                throw new InvalidPluginExecutionException("Failed to retrieve workflow context.");
            }

            tracingService.Trace(_processName + ".Execute(), Correlation Id: {0}, Initiating User: {1}",
                                 context.CorrelationId,
                                 context.InitiatingUserId);

            IOrganizationServiceFactory serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>();
            IOrganizationService        service        = serviceFactory.CreateOrganizationService(context.UserId);

            tracingService.Trace("entering 'try'", "");
            try
            {
                tracingService.Trace("building fetch", "");
                string fetchXml = @"<fetch distinct='false' mapping='logical' output-format='xml-platform' version='1.0'>
                        <entity name='queueitem'>
                            <attribute name='title'/>
                            <attribute name='enteredon'/>
                            <attribute name='objecttypecode'/>
                            <attribute name='objectid'/>
                            <attribute name='queueid'/>
                            <attribute name='workerid'/>
                            <order descending='false' attribute='enteredon'/>
                            <filter type='and'>
                                <condition attribute='statecode' value='0' operator='eq'/>
                                <condition attribute='objecttypecode' value='112' operator='eq'/>
                                <condition attribute='queueid' value='{0}' operator='eq'/>
                                <condition attribute='workerid' operator='null'/>
                            </filter>
                            <link-entity name='incident' alias='casealias' link-type='inner' to='objectid' from='incidentid'>
                                <attribute name='prioritycode'/>
                                <attribute name='ticketnumber'/>
                            </link-entity>
                        </entity>
                    </fetch> ";

                Guid queueId = Queue.Get(executionContext).Id;

                fetchXml = string.Format(fetchXml, queueId);

                tracingService.Trace("prepared fetchxml: {0}", fetchXml);

                tracingService.Trace("retrieving queue items", "");
                EntityCollection queueItems = service.RetrieveMultiple(new FetchExpression(fetchXml));

                tracingService.Trace("instantiating empty queueitem", "");
                Entity item       = new Entity("queueitem");
                string caseNumber = "";
                string caseTitle  = "";
                string caseId     = Guid.Empty.ToString();
                bool   caseFound  = false;

                if (queueItems.Entities.Count > 0)
                {
                    caseFound = true;
                    tracingService.Trace("processing queueitems", "");
                    item = queueItems.Entities[0];
                    tracingService.Trace("objectid: {0}", ((EntityReference)item["objectid"]).Id);
                    caseId     = ((EntityReference)item["objectid"]).Id.ToString();
                    caseTitle  = item["title"].ToString();
                    caseNumber = ((AliasedValue)item["casealias.ticketnumber"]).Value.ToString();

                    if (Assign.Get(executionContext))
                    {
                        tracingService.Trace("processing assignment", "");
                        PickFromQueueRequest request = new PickFromQueueRequest();
                        request.RemoveQueueItem = RemoveFromQueue.Get(executionContext);
                        request.QueueItemId     = item.Id;
                        request.WorkerId        = User.Get(executionContext).Id;
                        service.Execute(request);
                    }
                }

                tracingService.Trace("setting outputs", "");
                CaseId.Set(executionContext, caseId);
                CaseNumber.Set(executionContext, caseNumber);
                CaseTitle.Set(executionContext, caseTitle);
                CaseFound.Set(executionContext, caseFound);
            }
            catch (FaultException <OrganizationServiceFault> e)
            {
                tracingService.Trace("Exception: {0}", e.ToString());

                // Handle the exception.
                throw;
            }
            catch (Exception e)
            {
                tracingService.Trace("Exception: {0}", e.ToString());
                throw;
            }

            tracingService.Trace("Exiting " + _processName + ".Execute(), Correlation Id: {0}", context.CorrelationId);
        }
Example #9
0
 public Case GetCase(CaseId id)
 {
     return(GetCase(id, CaseColumns.Defaults));
 }
Example #10
0
        static Case parseCase(XElement element)
        {
            // ReSharper disable once UseObjectOrCollectionInitializer
            var result = new Case
            {
                Id = (CaseId)int.Parse(element.Attribute("ixBug").Value)
            };

            result.Parent          = CaseId.FromInt(getInt(element.Element(CaseColumns.Parent)));
            result.Children        = getCaseIds(element.Element(CaseColumns.Children));
            result.Duplicates      = getCaseIds(element.Element(CaseColumns.Duplicates));
            result.Original        = CaseId.FromInt(getInt(element.Element(CaseColumns.Original)));
            result.Related         = getCaseIds(element.Element(CaseColumns.Related));
            result.Tags            = getTags(element); // TODO: Write an integration test for tags.
            result.IsOpen          = getBool(element.Element(CaseColumns.IsOpen));
            result.Title           = getString(element.Element(CaseColumns.Title));
            result.OriginalTitle   = getString(element.Element(CaseColumns.OriginalTitle));
            result.LatestSummary   = getString(element.Element(CaseColumns.LatestSummary));
            result.LatestTextEvent = EventId.FromInt(getInt(element.Element(CaseColumns.LatestTextEvent)));
            result.Project         = getProject(element);
            result.Area            = new Area
            {
                Id   = getInt(element.Element(CaseColumns.AreaId)),
                Name = getString(element.Element(CaseColumns.Area))
            };
            result.AssignedTo = new Person
            {
                Id       = (PersonId)(getInt(element.Element(CaseColumns.AssignedToPersonId))),
                FullName = getString(element.Element(CaseColumns.AssignedTo)),
                Email    = getString(element.Element(CaseColumns.AssignedToEmail))
            };
            result.OpenedBy     = (PersonId)getInt(element.Element(CaseColumns.OpenedByPersonId));
            result.ResolvedBy   = PersonId.FromInt(getInt(element.Element(CaseColumns.ResolvedByPersonId)));
            result.ClosedBy     = PersonId.FromInt(getInt(element.Element(CaseColumns.ClosedByPersonId)));
            result.LastEditedBy = PersonId.FromInt(getInt(element.Element(CaseColumns.LastEditedByPersonId)));
            result.Status       = new Status
            {
                Id   = (StatusId)getInt(element.Element(CaseColumns.StatusId)),
                Name = getString(element.Element(CaseColumns.Status))
            };
            result.Priority = new Priority
            {
                Id   = getInt(element.Element(CaseColumns.PriorityId)),
                Name = getString(element.Element(CaseColumns.Priority))
            };
            result.FixFor = new Milestone
            {
                Id   = (MilestoneId)getInt(element.Element(CaseColumns.FixForMilestoneId)),
                Name = getString(element.Element(CaseColumns.FixFor)),
                Date = getDate(element.Element(CaseColumns.FixForDate))
            };
            result.Version  = getString(element.Element(CaseColumns.Version));
            result.Computer = getString(element.Element(CaseColumns.Computer));
            result.EstimateHoursOriginal = getDecimal(element.Element(CaseColumns.EstimateHoursOriginal));
            result.EstimateHoursCurrent  = getDecimal(element.Element(CaseColumns.EstimateHoursCurrent));
            result.ElapsedHours          = getDecimal(element.Element(CaseColumns.ElapsedHours));
            result.Occurrences           = getInt(element.Element(CaseColumns.Occurrences)) + 1;
            result.CustomerEmail         = getString(element.Element(CaseColumns.CustomerEmail));
            result.Mailbox  = MailboxId.FromInt(getInt(element.Element(CaseColumns.MailboxId)));
            result.Category = new Category
            {
                Id   = getInt(element.Element(CaseColumns.CategoryId)),
                Name = getString(element.Element(CaseColumns.Category))
            };
            result.OpenedDate          = getDate(element.Element(CaseColumns.OpenedDate));
            result.ResolvedDate        = getDate(element.Element(CaseColumns.ResolvedDate));
            result.ClosedDate          = getDate(element.Element(CaseColumns.ClosedDate));
            result.LatestEvent         = EventId.FromInt(getInt(element.Element(CaseColumns.LatestEventId)));
            result.LastUpdatedDate     = getDate(element.Element(CaseColumns.LastUpdatedDate));
            result.Replied             = getBool(element.Element(CaseColumns.Replied));
            result.Forwarded           = getBool(element.Element(CaseColumns.Forwarded));
            result.Ticket              = getString(element.Element(CaseColumns.Ticket));
            result.DiscussionTopic     = DiscussionId.FromInt(getInt(element.Element(CaseColumns.DiscussionTopicId)));
            result.DueDate             = getDate(element.Element(CaseColumns.DueDate));
            result.ReleaseNotes        = getString(element.Element(CaseColumns.ReleaseNotes));
            result.LastViewedEvent     = EventId.FromInt(getInt(element.Element(CaseColumns.LastViewedEventId)));
            result.LastViewedDate      = getDate(element.Element(CaseColumns.LastViewedDate));
            result.ScoutDescription    = getString(element.Element(CaseColumns.ScoutDescription));
            result.ScoutMessage        = getString(element.Element(CaseColumns.ScoutMessage));
            result.ScoutStopReporting  = getBool(element.Element(CaseColumns.ScoutStopReporting));
            result.ScoutLastOccurrence = getDate(element.Element(CaseColumns.ScoutLastOccurrence));
            result.Subscribed          = getBool(element.Element(CaseColumns.Subscribed));

            //var operations = element.Attribute("operations");
            return(result);
        }