Example #1
0
        public Task <HttpResponseMessage> AddLabelName(AddLabel addLabel)
        {
            ResponseBase <IList <micromsg.LabelPair> > response = new ResponseBase <IList <micromsg.LabelPair> >();

            try
            {
                var result = wechat.AddContactLabel(addLabel.WxId, addLabel.LabelName);
                if (result == null || result.BaseResponse.Ret != (int)MMPro.MM.RetConst.MM_OK)
                {
                    response.Success = false;
                    response.Code    = "501";
                    response.Message = result.BaseResponse.ErrMsg.String ?? "添加失败";
                }
                else
                {
                    response.Data    = result.LabelPairList;
                    response.Message = "添加成功";
                }
            }
            catch (ExpiredException ex)
            {
                response.Success = false;
                response.Code    = "401";
                response.Message = ex.Message;
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Code    = "500";
                response.Message = ex.Message;
            }
            return(response.ToHttpResponseAsync());
        }
        public async Task <IActionResult> AddLabel([FromRoute] Guid projectId, [FromBody] AddLabel command)
        {
            command.ProjectId = projectId;
            await commandQueryBus.SendAsync(command);

            return(Created("api/project-management/labels/", command.CreatedId));
        }
Example #3
0
        /// <summary>
        /// Adds the label.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="userId">The user identifier.</param>
        /// <returns></returns>
        public async Task <bool> AddLabel(AddLabel model, int userId)
        {
            try
            {
                SqlConnection connection = DBConnection();
                SqlCommand    command    = StoreProcedureConnection("spAddLabel", connection);
                connection.Open();
                command.Parameters.AddWithValue("LabelName", model.LabelName);
                command.Parameters.AddWithValue("UserId", userId);
                command.Parameters.AddWithValue("CreatedDateTime", DateTime.Now);
                int result = await command.ExecuteNonQueryAsync();

                connection.Close();
                if (result != 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                };
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public async Task HandleAsync(AddLabel command)
        {
            var project = await projectRepository.GetAsync(command.ProjectId);

            var projectVersion = project.Version;

            project.AddLabel(command);
            await projectRepository.Update(project, projectVersion);
        }
Example #5
0
        public async Task <IActionResult> AddLabel(AddLabel model)
        {
            int userId = TokenUserId();

            if (await labels.AddLabel(model, userId))
            {
                string status = "Label added";
                return(Ok(new { status, userId, model }));
            }
            else
            {
                string status = "Label did not added";
                return(BadRequest(new { status, userId, model }));
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (AddButton != null)
            {
                AddButton.Dispose();
                AddButton = null;
            }

            if (AddProduct != null)
            {
                AddProduct.Dispose();
                AddProduct = null;
            }

            if (ResetButton != null)
            {
                ResetButton.Dispose();
                ResetButton = null;
            }

            if (ShuffleSwitch != null)
            {
                ShuffleSwitch.Dispose();
                ShuffleSwitch = null;
            }

            if (ViewTouched != null)
            {
                ViewTouched.Dispose();
                ViewTouched = null;
            }

            if (AddLabel != null)
            {
                AddLabel.Dispose();
                AddLabel = null;
            }

            if (AddDescription != null)
            {
                AddDescription.Dispose();
                AddDescription = null;
            }
        }
Example #7
0
        public void SeedData(ICommandQueryBus commandQueryBus, IEventManager eventManager)
        {
            var queue                  = new Queue <IDomainEvent>();
            var adminCreated           = new UserCreated(AdminId, "Admin", "Admin", "*****@*****.**", Role.Admin);
            var userAssignedCreated    = new UserCreated(UserAssignedToProjectId, "Assigned", "Assigned", "*****@*****.**", Role.User);
            var userNotAssignedCreated = new UserCreated(UserNotAssignedToProjectId, "NotAssigned", "NotAssigned", "*****@*****.**", Role.User);

            queue.Enqueue(adminCreated);
            queue.Enqueue(userAssignedCreated);
            queue.Enqueue(userNotAssignedCreated);

            var createProject = new CreateProject(ProjectName);

            Task.Run(() => eventManager.PublishEventsAsync(queue)).Wait();

            Task.Run(() => commandQueryBus.SendAsync(createProject)).Wait();
            ProjectId = createProject.CreatedId;

            //Task.Run(() => commandQueryBus.SendAsync(new AssignUserToProject(AdminId, UserAssignedToProjectId, 1) { ProjectId = ProjectId})).Wait();

            AddLabel createLabel;

            for (int i = 0; i < 5; i++)
            {
                createLabel = new AddLabel(RandomString("NAME_"), RandomString("DESCR_"))
                {
                    ProjectId = ProjectId
                };
                Task.Run(() => commandQueryBus.SendAsync(createLabel)).Wait();
                LabelsIds.Add(createLabel.CreatedId);
            }


            var createTask = IssueExtensions.GenerateBasicCreateTaskCommand(this);

            Task.Run(() => commandQueryBus.SendAsync(createTask)).Wait();
            TaskId = createTask.CreatedId;

            var createNfr = IssueExtensions.GenerateBasicCreateNfrCommand(this);

            Task.Run(() => commandQueryBus.SendAsync(createNfr)).Wait();
            NfrId = createNfr.CreatedId;

            var createTasksBug = IssueExtensions.GenerateBasicAddBugToCommand(this, IssueType.Task);

            Task.Run(() => commandQueryBus.SendAsync(createTasksBug)).Wait();
            TasksBugId = createTasksBug.CreatedId;

            var createNfrsBug = IssueExtensions.GenerateBasicAddBugToCommand(this, IssueType.Nfr);

            Task.Run(() => commandQueryBus.SendAsync(createNfrsBug)).Wait();
            NfrsBugId = createNfrsBug.CreatedId;

            var createSprint = new CreateSprint(RandomString("Sprint_"), DateTime.UtcNow.Date, DateTime.UtcNow.Date.AddDays(14))
            {
                ProjectId = ProjectId
            };

            Task.Run(() => commandQueryBus.SendAsync(createSprint)).Wait();
            SprintId = createSprint.CreatedId;
        }
Example #8
0
 /// <summary>
 /// Adds the label.
 /// </summary>
 /// <param name="model">The model.</param>
 /// <param name="userId">The user identifier.</param>
 /// <returns></returns>
 public async Task <bool> AddLabel(AddLabel model, int userId)
 {
     return(await labels.AddLabel(model, userId));
 }