示例#1
0
 public CreateDistributablePlan(PlanId id, string name, string description, string owner)
 {
     Id          = (Guid)id;
     Name        = name;
     Description = description;
     Owner       = owner;
 }
        public ActionResult HandleAddCollaborator(
            [System.Web.Http.FromBody] Guid plan,
            [System.Web.Http.FromBody] string collaboratorUsername,
            [System.Web.Http.FromBody] string collaboratorRole)
        {
            if (string.IsNullOrEmpty(collaboratorUsername))
            {
                throw new ArgumentNullException(nameof(collaboratorUsername));
            }

            if (string.IsNullOrEmpty(collaboratorRole))
            {
                throw new ArgumentNullException(nameof(collaboratorRole));
            }


            if (!ModelState.IsValid)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, ModelState.Values.ToString()));
            }


            var planId = new PlanId(plan);

            var command = new AddCollaborator(planId, collaboratorUsername, collaboratorRole);

            Wiring.Proxy.SendCommand(command);

            return(new JsonResult()
            {
                JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                Data = command
            });
        }
示例#3
0
 public CreateCollaborativePlan(PlanId id, string name, string description, string owner)
 {
     Id          = (Guid)id;
     Name        = name;
     Description = description;
     Owner       = owner;
 }
示例#4
0
 public CreateTask(PlanId planId, TaskId taskId, string name, Reccurence interval)
 {
     PlanId   = (Guid)planId;
     TaskId   = (Guid)taskId;
     Name     = name;
     Interval = interval;
 }
示例#5
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(((ServiceId?.GetHashCode() ?? 0) * 397) ^ (PlanId?.GetHashCode() ?? 0));
     }
 }
示例#6
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is Subscription other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) &&
                   ((PlanId == null && other.PlanId == null) || (PlanId?.Equals(other.PlanId) == true)) &&
                   ((CustomerId == null && other.CustomerId == null) || (CustomerId?.Equals(other.CustomerId) == true)) &&
                   ((StartDate == null && other.StartDate == null) || (StartDate?.Equals(other.StartDate) == true)) &&
                   ((CanceledDate == null && other.CanceledDate == null) || (CanceledDate?.Equals(other.CanceledDate) == true)) &&
                   ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) &&
                   ((TaxPercentage == null && other.TaxPercentage == null) || (TaxPercentage?.Equals(other.TaxPercentage) == true)) &&
                   ((InvoiceIds == null && other.InvoiceIds == null) || (InvoiceIds?.Equals(other.InvoiceIds) == true)) &&
                   ((PriceOverrideMoney == null && other.PriceOverrideMoney == null) || (PriceOverrideMoney?.Equals(other.PriceOverrideMoney) == true)) &&
                   ((Version == null && other.Version == null) || (Version?.Equals(other.Version) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) &&
                   ((CardId == null && other.CardId == null) || (CardId?.Equals(other.CardId) == true)) &&
                   ((PaidUntilDate == null && other.PaidUntilDate == null) || (PaidUntilDate?.Equals(other.PaidUntilDate) == true)) &&
                   ((Timezone == null && other.Timezone == null) || (Timezone?.Equals(other.Timezone) == true)));
        }
示例#7
0
 public CreatePersonalPlan(PlanId id, string name, string description, string owner)
 {
     Id          = (Guid)id;
     Name        = name;
     Description = description;
     Owner       = owner;
 }
        public ActionResult HandleCreatePlan(
            [System.Web.Http.FromBody] string planName,
            [System.Web.Http.FromBody] string planDescription = "",
            [System.Web.Http.FromBody] PlanType plantype      = PlanType.Personal)
        {
            if (string.IsNullOrEmpty(planName))
            {
                throw new ArgumentNullException(nameof(planName));
            }

            var planId  = PlanId.Create();
            var command = (plantype == PlanType.Collaborative)
                ? new CreateCollaborativePlan(planId, planName, planDescription, Thread.CurrentPrincipal.Identity.Name)
                : (plantype == PlanType.Personal)
                    ? new CreatePersonalPlan(planId, planName, planDescription, Thread.CurrentPrincipal.Identity.Name)
                    : new CreateDistributablePlan(planId, planName, planDescription, Thread.CurrentPrincipal.Identity.Name) as Command;

            Wiring.Proxy.SendCommand(command);

            return(new JsonResult()
            {
                JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                Data = command
            });
        }
示例#9
0
        public TaskTests()
        {
            planId  = new PlanId(Guid.NewGuid());
            _taskId = (TaskId)Guid.NewGuid();

            bus = new Switchboard();
            bus.RegisterHandler <CreateTask>((t) => { this._task = new Task(t.TaskId, t.PlanId, t.Name, t.Interval); });
        }
        public override int GetHashCode()
        {
            int hashCode = 801909259;

            if (IdempotencyKey != null)
            {
                hashCode += IdempotencyKey.GetHashCode();
            }

            if (LocationId != null)
            {
                hashCode += LocationId.GetHashCode();
            }

            if (PlanId != null)
            {
                hashCode += PlanId.GetHashCode();
            }

            if (CustomerId != null)
            {
                hashCode += CustomerId.GetHashCode();
            }

            if (StartDate != null)
            {
                hashCode += StartDate.GetHashCode();
            }

            if (CanceledDate != null)
            {
                hashCode += CanceledDate.GetHashCode();
            }

            if (TaxPercentage != null)
            {
                hashCode += TaxPercentage.GetHashCode();
            }

            if (PriceOverrideMoney != null)
            {
                hashCode += PriceOverrideMoney.GetHashCode();
            }

            if (CardId != null)
            {
                hashCode += CardId.GetHashCode();
            }

            if (Timezone != null)
            {
                hashCode += Timezone.GetHashCode();
            }

            return(hashCode);
        }
        public override int GetHashCode()
        {
            int hashCode = 1685690023;

            if (Context != null)
            {
                hashCode += Context.GetHashCode();
            }

            if (AccessToken != null)
            {
                hashCode += AccessToken.GetHashCode();
            }

            if (TokenType != null)
            {
                hashCode += TokenType.GetHashCode();
            }

            if (ExpiresAt != null)
            {
                hashCode += ExpiresAt.GetHashCode();
            }

            if (MerchantId != null)
            {
                hashCode += MerchantId.GetHashCode();
            }

            if (SubscriptionId != null)
            {
                hashCode += SubscriptionId.GetHashCode();
            }

            if (PlanId != null)
            {
                hashCode += PlanId.GetHashCode();
            }

            if (IdToken != null)
            {
                hashCode += IdToken.GetHashCode();
            }

            if (RefreshToken != null)
            {
                hashCode += RefreshToken.GetHashCode();
            }

            if (ShortLived != null)
            {
                hashCode += ShortLived.GetHashCode();
            }

            return(hashCode);
        }
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = ServiceId?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (PlanId?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (BindResource?.GetHashCode() ?? 0);
         return(hashCode);
     }
 }
示例#13
0
        static void GenerateAcmePlan()
        {
            var planId  = PlanId.Create();
            var newPLan = new CreateCollaborativePlan(planId, "ACME plan", "Description goes here...", "BigBoss(guest)");

            Wiring.Proxy.SendCommand(newPLan);

            foreach (string task in "Write executive summary,Tax planning".Split(','))
            {
                Console.WriteLine(task);
                var taskId = TaskId.Create();
                Wiring.Proxy.SendCommand(new CreateTask(planId, taskId, task, Reccurence.Daily));
                Wiring.Proxy.SendCommand(new AssociateTaskToPlan(planId, taskId));
                Thread.Sleep(200);
            }
        }
示例#14
0
        private static void GenerateSignePlan()
        {
            var planId  = PlanId.Create();
            var newPLan = new CreateCollaborativePlan(planId, "Signes behov", "Description goes here...", Thread.CurrentPrincipal.Identity.Name);

            Wiring.Proxy.SendCommand(newPLan);

            Wiring.Proxy.SendCommand(new AddCollaborator(planId, "jonas(guest)", "Admin"));
            Wiring.Proxy.SendCommand(new AddCollaborator(planId, "jenny(guest)", "Collaborator"));

            foreach (var task in "D-droppar,Kåvepenin - morgon,Kåvepenin - eftermiddag,Kåvepenin - kväll,Borsta tänderna - morgon,Borsta tänderna - kväll,Kolla naglar".Split(','))
            {
                Console.WriteLine(task);
                var taskId = TaskId.Create();
                Wiring.Proxy.SendCommand(new CreateTask(planId, taskId, task, Reccurence.Daily));
                Wiring.Proxy.SendCommand(new AssociateTaskToPlan(planId, taskId));
                Thread.Sleep(200);
            }
        }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (PassportId != null)
         {
             hashCode = hashCode * 59 + PassportId.GetHashCode();
         }
         hashCode = hashCode * 59 + PlanId.GetHashCode();
         if (OptionalLinkedSubscriptionId != null)
         {
             hashCode = hashCode * 59 + OptionalLinkedSubscriptionId.GetHashCode();
         }
         if (SubscriptionDate != null)
         {
             hashCode = hashCode * 59 + SubscriptionDate.GetHashCode();
         }
         if (ExpirationDate != null)
         {
             hashCode = hashCode * 59 + ExpirationDate.GetHashCode();
         }
         hashCode = hashCode * 59 + CurrentTokensUsed.GetHashCode();
         hashCode = hashCode * 59 + ExtraTokens.GetHashCode();
         if (ExtraTokensEndDate != null)
         {
             hashCode = hashCode * 59 + ExtraTokensEndDate.GetHashCode();
         }
         hashCode = hashCode * 59 + IsYearlyPaid.GetHashCode();
         hashCode = hashCode * 59 + IsActive.GetHashCode();
         hashCode = hashCode * 59 + TokensPercentUsageAlert.GetHashCode();
         hashCode = hashCode * 59 + TokensPercentUsageAlertSent.GetHashCode();
         hashCode = hashCode * 59 + IsManaged.GetHashCode();
         if (NextMonthlyTerm != null)
         {
             hashCode = hashCode * 59 + NextMonthlyTerm.GetHashCode();
         }
         hashCode = hashCode * 59 + RemainingTokens.GetHashCode();
         return(hashCode);
     }
 }
        public ActionResult HandleCreateTask(
            [System.Web.Http.FromBody] Guid plan,
            [System.Web.Http.FromBody] string taskTitle)
        {
            if (string.IsNullOrEmpty(taskTitle))
            {
                throw new ArgumentNullException(nameof(taskTitle));
            }

            var planId = new PlanId(plan);
            var taskId = (TaskId)Guid.NewGuid();

            var command = new CreateTask(planId, taskId, taskTitle, Reccurence.Daily);

            Wiring.Proxy.SendCommand(command);

            return(new JsonResult()
            {
                JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                Data = command
            });
        }
示例#17
0
        static void GenerateDesmondPlan()
        {
            var days = CultureInfo.CurrentCulture.DateTimeFormat.DayNames;

            var planId  = PlanId.Create();
            var newPLan = new CreateCollaborativePlan(planId, "Desmonds åtaganden", "Saker som Desmond ska göra för att få veckopeng", Thread.CurrentPrincipal.Identity.Name);

            Wiring.Proxy.SendCommand(newPLan);

            Wiring.Proxy.SendCommand(new AddCollaborator(planId, "jonas(guest)", "Admin"));
            Wiring.Proxy.SendCommand(new AddCollaborator(planId, "jenny(guest)", "Collaborator"));
            Wiring.Proxy.SendCommand(new AddCollaborator(planId, "desmond(guest)", "Auditor"));

            foreach (var taskTitle in "Städa rummet (Varje vecka),Gå igenom läsläxa(Varje vecka på Onsdag),Packa gympakläder(Varje vecka på Torsdag),Kolla naglar(Varje vecka på Söndag)".Split(','))
            {
                Console.WriteLine(taskTitle);

                var reccurence = (taskTitle.Contains("Varje vecka"))
                                ? Reccurence.Weekly
                                : Reccurence.Daily;

                var taskId      = TaskId.Create();
                var taskCommand = new CreateTask(planId, taskId, taskTitle, reccurence);
                Wiring.Proxy.SendCommand(taskCommand);
                Wiring.Proxy.SendCommand(new AssociateTaskToPlan(planId, taskId));
                Thread.Sleep(200); // Power nap to allow cool down...

                var complete = new MarkTaskCompleted(taskId, "jonas(guest)", DateTimeOffset.Now);
                Wiring.Proxy.SendCommand(complete);
                Thread.Sleep(200); // Power nap to allow cool down...

                // Check for day names in the culture,



                // Check if we can generate and reccurence policy, ie "Every week on Tuesdays" => "Every [interval] on [dayName]"
            }
        }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is CreateSubscriptionRequest other &&
                   ((IdempotencyKey == null && other.IdempotencyKey == null) || (IdempotencyKey?.Equals(other.IdempotencyKey) == true)) &&
                   ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) &&
                   ((PlanId == null && other.PlanId == null) || (PlanId?.Equals(other.PlanId) == true)) &&
                   ((CustomerId == null && other.CustomerId == null) || (CustomerId?.Equals(other.CustomerId) == true)) &&
                   ((StartDate == null && other.StartDate == null) || (StartDate?.Equals(other.StartDate) == true)) &&
                   ((CanceledDate == null && other.CanceledDate == null) || (CanceledDate?.Equals(other.CanceledDate) == true)) &&
                   ((TaxPercentage == null && other.TaxPercentage == null) || (TaxPercentage?.Equals(other.TaxPercentage) == true)) &&
                   ((PriceOverrideMoney == null && other.PriceOverrideMoney == null) || (PriceOverrideMoney?.Equals(other.PriceOverrideMoney) == true)) &&
                   ((CardId == null && other.CardId == null) || (CardId?.Equals(other.CardId) == true)) &&
                   ((Timezone == null && other.Timezone == null) || (Timezone?.Equals(other.Timezone) == true)));
        }
示例#19
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);

            // Try cast the value...
            var planIdValue = filterContext.ActionParameters[ParamName];

            // REVISIT Possible double convertion
            var planid = new PlanId(new Guid(planIdValue.ToString()));

            var allowedRoles = new List <string>(AllowedRoles)
                               .ConvertAll(r => r.ToLower());

            // Get the roles for the current user...
            var collaboratorsInPlan = Wiring.Proxy.Collaborators.ByPlanId((Guid)planid);

            var currentUserRoles =
                collaboratorsInPlan
                .Where(c => c.Username.StartsWith(filterContext.HttpContext.User.Identity.Name))
                .ToList()
                .ConvertAll(r => r.Role.ToLower());

            // Match against current user..start
            var userIsInRole = currentUserRoles.Intersect(allowedRoles).Any();

            if (!userIsInRole)
            {
                // Find the roles

                filterContext.Result = new HttpStatusCodeResult(
                    HttpStatusCode.BadRequest,
                    string.Format("The operation requires any of the following roles: {0}. The user has roles: {1}",
                                  string.Join(",", allowedRoles),
                                  string.Join(",", currentUserRoles)));
            }
        }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is ObtainTokenResponse other &&
                   ((Context == null && other.Context == null) || (Context?.Equals(other.Context) == true)) &&
                   ((AccessToken == null && other.AccessToken == null) || (AccessToken?.Equals(other.AccessToken) == true)) &&
                   ((TokenType == null && other.TokenType == null) || (TokenType?.Equals(other.TokenType) == true)) &&
                   ((ExpiresAt == null && other.ExpiresAt == null) || (ExpiresAt?.Equals(other.ExpiresAt) == true)) &&
                   ((MerchantId == null && other.MerchantId == null) || (MerchantId?.Equals(other.MerchantId) == true)) &&
                   ((SubscriptionId == null && other.SubscriptionId == null) || (SubscriptionId?.Equals(other.SubscriptionId) == true)) &&
                   ((PlanId == null && other.PlanId == null) || (PlanId?.Equals(other.PlanId) == true)) &&
                   ((IdToken == null && other.IdToken == null) || (IdToken?.Equals(other.IdToken) == true)) &&
                   ((RefreshToken == null && other.RefreshToken == null) || (RefreshToken?.Equals(other.RefreshToken) == true)) &&
                   ((ShortLived == null && other.ShortLived == null) || (ShortLived?.Equals(other.ShortLived) == true)));
        }
示例#21
0
        public override void Execute()
        {
            return;

            try
            {
                _logger.LogInformation("执行LED消息推送动作 {0} Begin.....", PlanId);
                //获取声光报警设备,并按组织机构分组
                string url = string.Format("{0}/Resources/IPDevice/systemOptionId={1}", GlobalSetting.AppServerBaseUrl, "A0002016-E009-B019-E001-ABCD11000006");
                IEnumerable <IPDeviceInfo> soundLightDevices = HttpClientHelper.Get <IPDeviceInfo>(url);
                var soundLightDeviceGroup = soundLightDevices.Join(m_actionArgumentList, p => p.IPDeviceInfoId, q => q.SoundLightDeviceId, (p, q) => new { Device = p, Message = q.LedText }).GroupBy(t => t.Device.OrganizationId);

                //获取哨位中心服务
                //url = string.Format("{0}/Resources/Service/ServiceTypeId={1}", GlobalSetting.AppServerBaseUrl, "A0002016-E009-B019-E001-ABCD11300206");
                //IEnumerable<ServiceInfo> services = HttpClientHelper.Get<ServiceInfo>(url);

                //url = string.Format("{0}//Infrastructure/Organization/isorganizationtype=false", GlobalSetting.AppServerBaseUrl);
                //IEnumerable<Organization> orgs = HttpClientHelper.Get<Organization>(url);
                foreach (var sg in soundLightDeviceGroup)
                {
                    //var deviceOrg = orgs.FirstOrDefault(t => t.OrganizationId.Equals(sg.Key));
                    //ServiceInfo service = services.FirstOrDefault(t => t.ServerInfo.OrganizationId.Equals(deviceOrg.ParentOrganizationId) ||
                    //        t.ServerInfo.OrganizationId.Equals(sg.Key));
                    var service = TaskUtility.GetASCService(sg.Key);
                    if (service != null)
                    {
                        //判断是否有报警
                        ASCSApi ascs = new ASCSApi(service);
                        foreach (var device in sg)
                        {
                            string message = device.Message;
                            if (PlanTrigger != null)
                            {
                                var alarmTextObj = TaskUtility.SoundlightConfigList.FirstOrDefault(t => t.AlarmTypeId.Equals(PlanTrigger.AlarmType.SystemOptionId));
                                var alarmdesc    = alarmTextObj != null ? alarmTextObj.Description : "";
                                if (PlanId.Equals(PlanTrigger.BeforePlanId))
                                {
                                    message = string.Format("{0}{1},各小组请注意观察!", PlanTrigger.AlarmSource.IPDeviceName, alarmdesc);
                                }
                                else if (PlanId.Equals(PlanTrigger.EmergencyPlanId))
                                {
                                    message = string.Format("{0}{1},各小组按预案处置!", alarmdesc);
                                }
                            }

                            //message = "\0"; //清空
                            _logger.LogInformation("推送消息 Begin ....发送[{0}]到{1}", message, device.Device.IPDeviceName);
                            PushMessage msg = new PushMessage()
                            {
                                DeviceCode = device.Device.IPDeviceCode,
                                Message    = message
                            };
                            ascs.PushMessage(msg);
                            _logger.LogInformation("推送消息 End");
                        }
                        _logger.LogInformation("执行LED消息推送动作 {0} End.....", PlanId);
                    }
                    else
                    {
                        _logger.LogInformation("未配置哨位中心服务,取消推送消息");
                    }
                }
            }catch (Exception ex)
            {
                _logger.LogError("执行文字推送动作异常:{0}\r\n{1}", ex.Message, ex.StackTrace);
            }
        }
 public override int GetHashCode() => PlanId?.GetHashCode() ?? 0;
示例#23
0
        public override int GetHashCode()
        {
            int hashCode = -1265150766;

            if (Id != null)
            {
                hashCode += Id.GetHashCode();
            }

            if (LocationId != null)
            {
                hashCode += LocationId.GetHashCode();
            }

            if (PlanId != null)
            {
                hashCode += PlanId.GetHashCode();
            }

            if (CustomerId != null)
            {
                hashCode += CustomerId.GetHashCode();
            }

            if (StartDate != null)
            {
                hashCode += StartDate.GetHashCode();
            }

            if (CanceledDate != null)
            {
                hashCode += CanceledDate.GetHashCode();
            }

            if (Status != null)
            {
                hashCode += Status.GetHashCode();
            }

            if (TaxPercentage != null)
            {
                hashCode += TaxPercentage.GetHashCode();
            }

            if (InvoiceIds != null)
            {
                hashCode += InvoiceIds.GetHashCode();
            }

            if (PriceOverrideMoney != null)
            {
                hashCode += PriceOverrideMoney.GetHashCode();
            }

            if (Version != null)
            {
                hashCode += Version.GetHashCode();
            }

            if (CreatedAt != null)
            {
                hashCode += CreatedAt.GetHashCode();
            }

            if (CardId != null)
            {
                hashCode += CardId.GetHashCode();
            }

            if (PaidUntilDate != null)
            {
                hashCode += PaidUntilDate.GetHashCode();
            }

            if (Timezone != null)
            {
                hashCode += Timezone.GetHashCode();
            }

            return(hashCode);
        }
示例#24
0
 static Guid PLanIdToGuid(PlanId planId)
 {
     return((Guid)planId);
     // Point(((int)pf.X), ((int)pf.Y));
 }
        /// <summary>
        /// Returns true if PassportPDFPassport instances are equal
        /// </summary>
        /// <param name="input">Instance of PassportPDFPassport to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(PassportPDFPassport input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     PassportId == input.PassportId ||
                     (PassportId != null &&
                      PassportId.Equals(input.PassportId))
                     ) &&
                 (
                     PlanId == input.PlanId ||
                     PlanId.Equals(input.PlanId)
                 ) &&
                 (
                     OptionalLinkedSubscriptionId == input.OptionalLinkedSubscriptionId ||
                     (OptionalLinkedSubscriptionId != null &&
                      OptionalLinkedSubscriptionId.Equals(input.OptionalLinkedSubscriptionId))
                 ) &&
                 (
                     SubscriptionDate == input.SubscriptionDate ||
                     (SubscriptionDate != null &&
                      SubscriptionDate.Equals(input.SubscriptionDate))
                 ) &&
                 (
                     ExpirationDate == input.ExpirationDate ||
                     (ExpirationDate != null &&
                      ExpirationDate.Equals(input.ExpirationDate))
                 ) &&
                 (
                     CurrentTokensUsed == input.CurrentTokensUsed ||
                     CurrentTokensUsed.Equals(input.CurrentTokensUsed)
                 ) &&
                 (
                     ExtraTokens == input.ExtraTokens ||
                     ExtraTokens.Equals(input.ExtraTokens)
                 ) &&
                 (
                     ExtraTokensEndDate == input.ExtraTokensEndDate ||
                     (ExtraTokensEndDate != null &&
                      ExtraTokensEndDate.Equals(input.ExtraTokensEndDate))
                 ) &&
                 (
                     IsYearlyPaid == input.IsYearlyPaid ||
                     IsYearlyPaid.Equals(input.IsYearlyPaid)
                 ) &&
                 (
                     IsActive == input.IsActive ||
                     IsActive.Equals(input.IsActive)
                 ) &&
                 (
                     TokensPercentUsageAlert == input.TokensPercentUsageAlert ||
                     TokensPercentUsageAlert.Equals(input.TokensPercentUsageAlert)
                 ) &&
                 (
                     TokensPercentUsageAlertSent == input.TokensPercentUsageAlertSent ||
                     TokensPercentUsageAlertSent.Equals(input.TokensPercentUsageAlertSent)
                 ) &&
                 (
                     IsManaged == input.IsManaged ||
                     IsManaged.Equals(input.IsManaged)
                 ) &&
                 (
                     NextMonthlyTerm == input.NextMonthlyTerm ||
                     (NextMonthlyTerm != null &&
                      NextMonthlyTerm.Equals(input.NextMonthlyTerm))
                 ) &&
                 (
                     RemainingTokens == input.RemainingTokens ||
                     RemainingTokens.Equals(input.RemainingTokens)
                 ));
        }
示例#26
0
 public AssociateTaskToPlan(PlanId planId, TaskId taskId)
 {
     PlanId = planId;
     TaskId = taskId;
 }
示例#27
0
        public async Task <List <string> > LogResults(List <VstsTestCaseResult> results)
        {
            var orgUri = new Uri(OrganizationUrl);

            VssCredentials credentials = new VssCredentials(new Microsoft.VisualStudio.Services.Common.VssBasicCredential(string.Empty, Personalaccesstoken));
            var            connection  = new VssConnection(orgUri, credentials);

            using (var testClient = connection.GetClient <TestManagementHttpClient>())
            {
                var resultPointIds = results.Where(p => _testCaseToPointMap.Keys.Contains(p.Id)).Select(p => GetPointIdByCaseId(p.Id)).ToArray();

                List <TestCaseResult> testcaseResults = new List <TestCaseResult>();
                foreach (var pointId in resultPointIds)
                {
                    TestCaseResult temp = new TestCaseResult()
                    {
                        State = "Completed"
                    };
                    temp.Id        = GenerateTestResultID();
                    temp.TestPoint = new ShallowReference(pointId.ToString());
                    var current = results.Where(p => p.Id == GetCaseIdByPointId(pointId)).First();
                    temp.Outcome = current.Outcome;
                    if (current.AssociatedBugs != null)
                    {
                        var tempDefects = new List <ShallowReference>();
                        foreach (var defect in current.AssociatedBugs)
                        {
                            tempDefects.Add(new ShallowReference(defect));
                        }
                        temp.AssociatedBugs = tempDefects;
                    }
                    temp.Comment = current.Comment;
                    testcaseResults.Add(temp);
                }

                RunCreateModel run     = new RunCreateModel(name: "Mvt", plan: new ShallowReference(PlanId.ToString()), pointIds: resultPointIds);
                TestRun        testrun = await testClient.CreateTestRunAsync(run, ProjectName);

                var testResults = await testClient.UpdateTestResultsAsync(testcaseResults.ToArray(), ProjectName, testrun.Id);

                RunUpdateModel runmodel      = new RunUpdateModel(state: "Completed", deleteUnexecutedResults: true);  //, deleteUnexecutedResults: true);
                TestRun        testRunResult = await testClient.UpdateTestRunAsync(runmodel, ProjectName, testrun.Id); //, runmodel);

                var loggedCases = await testClient.GetTestResultsAsync(ProjectName, testRunResult.Id);

                return(loggedCases.Select(p => p.TestCase.Id).ToList());
                //TestRunState.Completed;
                //TestRunOutcome.Passed.ToString();
            }
        }
示例#28
0
        public PlanModel(PlanSetup _planSetup)
        {
            if (null == _planSetup)
            {
                return;
            }
            PlanId                   = _planSetup.Id;
            IsTreated                = _planSetup.IsTreated;
            PlanningApprover         = _planSetup.PlanningApprover;
            TreatmentApprover        = _planSetup.TreatmentApprover;
            TreatmentApproveDateTime = _planSetup.TreatmentApprovalDate;

            FieldModels = new ObservableCollection <FieldModel>();

            // 现阶段暂时无法利用ESAPI获取计划的程数或者是部位信息
            // 假定现阶段的程数和部位都是正确的
            // TODO 查找确定程数和部位的方法

            // 获取Plan的命名
            ApprovalStatus = Enum.GetName(typeof(PlanSetupApprovalStatus), _planSetup.ApprovalStatus);

            bool isArcPlan    = false;
            int  treatBeamNum = 0;

            foreach (Beam planSetupBeam in _planSetup.Beams)
            {
                FieldModel fm = new FieldModel(planSetupBeam);
                FieldModels.Add(fm);
                if (!planSetupBeam.IsSetupField)
                {
                    treatBeamNum++;
                    if (planSetupBeam.Technique.Id.ToLower().Equals("arc"))
                    {
                        isArcPlan = true;
                    }
                }
            }

            // 生成命名
            if (0 == treatBeamNum)
            {
                RecommendId = PlanId;
                if (RecommendId.ToLower().Equals(PlanId.ToLower()))
                {
                    IsAllDatainished = true;
                    IsConsistent     = true;
                    return;
                }
            }
            RecommendId = $"{PlanId[0]}{treatBeamNum}{(isArcPlan ? "VMAT" : "IMRT")}a";
            if (RecommendId.ToLower().Equals(PlanId.ToLower()))
            {
                IsAllDatainished = true;
                IsConsistent     = true;
                return;
            }
            else
            {
                IsAllDatainished = true;
                IsConsistent     = false;
                return;
            }
        }
示例#29
0
        public override void Execute()
        {
            return;

            _logger.LogInformation("执行语言播报联动动作 {0} Begin.....", PlanId);
            try
            {
                //获取声光报警设备,并按组织机构分组
                string url = string.Format("{0}/Resources/IPDevice/systemOptionId={1}", GlobalSetting.AppServerBaseUrl, "A0002016-E009-B019-E001-ABCD11000006");
                IEnumerable <IPDeviceInfo> soundLightDevices = HttpClientHelper.Get <IPDeviceInfo>(url);
                var soundLightDeviceGroup = soundLightDevices.Join(m_actionArgumentList, p => p.IPDeviceInfoId, q => q.SoundLightDeviceId, (p, q) =>
                                                                   new { Device = p, Argument = q }).GroupBy(t => t.Device.OrganizationId);

                ////获取哨位中心服务
                //url = string.Format("{0}/Resources/Service/ServiceTypeId={1}", GlobalSetting.AppServerBaseUrl, "A0002016-E009-B019-E001-ABCD11300206");
                //IEnumerable<ServiceInfo> services = HttpClientHelper.Get<ServiceInfo>(url);

                //url = string.Format("{0}//Infrastructure/Organization/isorganizationtype=false", GlobalSetting.AppServerBaseUrl);
                //IEnumerable<Organization> orgs = HttpClientHelper.Get<Organization>(url);
                foreach (var sg in soundLightDeviceGroup)
                {
                    //var deviceOrg = orgs.FirstOrDefault(t => t.OrganizationId.Equals(sg.Key));
                    //ServiceInfo service = services.FirstOrDefault(t => t.ServerInfo.OrganizationId.Equals(deviceOrg.ParentOrganizationId) ||
                    //        t.ServerInfo.OrganizationId.Equals(sg.Key));
                    var service = TaskUtility.GetASCService(sg.Key);

                    if (service != null)
                    {
                        ASCSApi ascs = new ASCSApi(service);
                        foreach (var device in sg)
                        {
                            string audioFile    = device.Argument.AudioFile;
                            int    sentinelCode = -1;
                            if (PlanTrigger != null)
                            {
                                sentinelCode = PlanTrigger.AlarmSource.IPDeviceCode;//Int32.Parse(PlanTrigger.AlarmSource.Organization.OrganizationCode);
                                if (PlanId.Equals(PlanTrigger.EmergencyPlanId))
                                {
                                    audioFile = string.Format("sound/{0}处置/{1}号哨{2}处置.wav", PlanTrigger.AlarmType.SystemOptionName,
                                                              sentinelCode /*PlanTrigger.AlarmSource.IPDeviceCode*/, PlanTrigger.AlarmType.SystemOptionName);
                                }
                                else if (PlanId.Equals(PlanTrigger.BeforePlanId))
                                {
                                    audioFile = string.Format("sound/{0}一级/{1}号哨发生犯人{2}.wav", PlanTrigger.AlarmType.SystemOptionName,
                                                              sentinelCode /*PlanTrigger.AlarmSource.IPDeviceCode*/, PlanTrigger.AlarmType.SystemOptionName);
                                }
                            }
                            //audioFile = device.Argument.AudioFile;
                            SoundLightControl action = new SoundLightControl()
                            {
                                DeviceCode   = device.Device.IPDeviceCode,
                                Message      = string.Empty,
                                Ledbitmask   = -1,
                                Audio        = audioFile,
                                SentinelCode = sentinelCode
                            };
                            _logger.LogInformation("下发语音播报:{0}", JsonUtility.CamelCaseSerializeObject(action));
                            ascs.SendSoundLightAction(action);
                            _logger.LogInformation("下发语音播报完成");
                        }
                    }
                    else
                    {
                        _logger.LogInformation("找不到设备对应的哨位中心服务,取消播报音频!!!");
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.LogError("执行语音播报动作异常:{0}\r\n{1}", ex.Message, ex.StackTrace);
            }
            _logger.LogInformation("执行语言播报联动动作 {0} End.....", PlanId);
        }
示例#30
0
 public AddCollaborator(PlanId planId, string collaborator, string role)
 {
     PlanId       = (Guid)planId;
     Collaborator = collaborator;
     Role         = role;
 }