private async Task SelectMilestone(MilestoneModel x) { if (SaveOnSelect) { try { IsSaving = true; int? milestone = null; if (x != null) milestone = x.Number; var updateReq = this.GetApplication().Client.Users[Username].Repositories[Repository].Issues[Id].UpdateMilestone(milestone); var newIssue = await this.GetApplication().Client.ExecuteAsync(updateReq); Messenger.Publish(new IssueEditMessage(this) { Issue = newIssue.Data }); } catch { DisplayAlert("Unable to to save milestone! Please try again."); } finally { IsSaving = false; } } else { Messenger.Publish(new SelectedMilestoneMessage(this) { Milestone = x }); } ChangePresentation(new MvvmCross.Core.ViewModels.MvxClosePresentationHint(this)); }
public async Task <bool> AddMilestoneAsync(MilestoneModel milestone) { using (SqlConnection conn = GetConnection()) { conn.Open(); var transaction = conn.BeginTransaction(); try { var list = new List <ProjectTaskModel>(); DynamicParameters param = new DynamicParameters(); if (milestone.MileStoneId > 0) { param.Add("@MileStoneId", milestone.MileStoneId); } param.Add("@Name", milestone.Name); param.Add("@DueDate", milestone.DueDate); param.Add("@StartDate", milestone.StartDate); param.Add("@ExpectedDate", milestone.ExpectedDate); param.Add("@ResponsiblePersonId", milestone.ResponsiblePersonId); param.Add("@CreatedBy", milestone.CreatedBy); int TaskId = await transaction.Connection.ExecuteScalarAsync <int>("sp_AddMilestone", param, transaction : transaction, commandType : CommandType.StoredProcedure); transaction.Commit(); return(true); } catch (Exception ex) { transaction.Rollback(); return(false); } } }
public IssueMilestonesViewController(string user, string repo) { Title = "Milestones".t(); NoItemsText = "No Milestones".t(); SearchPlaceholder = "Search Milestones".t(); ViewModel = new IssueMilestonesViewModel(user, repo); //Add a fake 'Unassigned' guy so we can always unassigned what we've done ViewModel.BindCollection(x => x.Milestones, (ev) => { var items = ViewModel.Milestones.ToList(); var noMilestone = new MilestoneModel { Title = "No Milestone".t() }; items.Insert(0, noMilestone); RenderList(items, x => { return(new StyledStringElement(x.Title, () => { if (MilestoneSelected != null) { MilestoneSelected(x == noMilestone ? null : x); } })); }, ViewModel.Milestones.MoreItems); }); }
private async Task SelectMilestone(MilestoneModel x) { if (SaveOnSelect) { try { IsSaving = true; int?milestone = null; if (x != null) { milestone = x.Number; } var updateReq = this.GetApplication().Client.Users[Username].Repositories[Repository].Issues[Id].UpdateMilestone(milestone); var newIssue = await this.GetApplication().Client.ExecuteAsync(updateReq); _messageService.Send(new IssueEditMessage(newIssue.Data)); } catch { DisplayAlert("Unable to to save milestone! Please try again."); } finally { IsSaving = false; } } else { _messageService.Send(new SelectedMilestoneMessage(x)); } ChangePresentation(new MvvmCross.Core.ViewModels.MvxClosePresentationHint(this)); }
private void SetClipboard(MilestoneModel milestone) { StringBuilder sbhtml = new StringBuilder(); sbhtml.Append("<p style='font-size:14px;font-family:Arial'><b>"); sbhtml.Append("Assigned Person: </b>"); sbhtml.Append(milestone.UserName); sbhtml.Append("</p>"); sbhtml.Append("<p style='font-size:14px;font-family:Arial'><b>"); sbhtml.Append("Description:</b></p>"); sbhtml.Append("<p style='font-size:14px;font-family:Arial'>"); sbhtml.Append(milestone.Description); sbhtml.Append("</p><br/>"); sbhtml.Append("<p style='font-size:14px;font-family:Arial'><b>"); sbhtml.Append("Due Date: </b>"); sbhtml.Append(milestone.TargetDate.Value.ToString("dd-MMM-yyyy")); sbhtml.Append("</p>"); StringBuilder sbtext = new StringBuilder(); sbtext.Append("Assigned Person: "); sbtext.Append(milestone.UserName); sbtext.Append("\n"); sbtext.Append("Description:\n"); sbtext.Append(milestone.Description); sbtext.Append("\n\n"); sbtext.Append("Due Date: "); sbtext.Append(milestone.TargetDate.Value.ToString("dd-MMM-yyyy")); ClipboardHelper.CopyToClipboard(sbhtml.ToString(), sbtext.ToString()); }
public HttpResponseMessage GetTaskList(Int64 projectId, string filterOption) { List <MilestoneModel> Mlist = new List <MilestoneModel>(); List <MilestoneModel> Tlist = new List <MilestoneModel>(); PM_DashboardDL pd = new PM_DashboardDL(); DataTable dt = pd.GetMileStoneValues("Get_Project_Tasks", projectId, 0, filterOption); foreach (DataRow item in dt.Rows) { MilestoneModel mil = new MilestoneModel(); MilestoneModel tsk = new MilestoneModel(); tsk.TaskId = Convert.ToInt64(item["TaskId"].ToString()); tsk.PTaskId = Convert.ToInt64(item["PTaskId"].ToString()); tsk.Task = item["Task"].ToString(); tsk.Color = item["Color"].ToString(); tsk.ProjectId = Convert.ToInt64(item["ProjectId"].ToString()); tsk.ActualSites = Convert.ToInt32(item["ActualSites"].ToString()); tsk.TotalSites = Convert.ToInt32(item["TotalSites"].ToString()); mil.TaskId = Convert.ToInt64(item["TaskId"].ToString()); mil.PTaskId = Convert.ToInt64(item["PTaskId"].ToString()); mil.Task = item["Task"].ToString(); mil.Color = item["Color"].ToString(); mil.ProjectId = Convert.ToInt64(item["ProjectId"].ToString()); mil.ActualSites = Convert.ToInt32(item["ActualSites"].ToString()); mil.TotalSites = Convert.ToInt32(item["TotalSites"].ToString()); if (tsk.PTaskId == 0) { Mlist.Add(mil); } else { Tlist.Add(tsk); } } foreach (var mile in Mlist) { foreach (var task in Tlist) { if (task.PTaskId == mile.TaskId) { mile.Tasks = Tlist; break; } } } if (Mlist != null) { return(Request.CreateResponse(HttpStatusCode.OK, Mlist)); } else { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Record with Id " + projectId.ToString() + " not found")); } }
// POST: api/Milestone public void Post([FromBody] MilestoneModel value, int tenderId) { var milestone = Mapper.Map <MilestoneModel, Milestone>(value); var tender = _tenderService.GetTenderById(tenderId); milestone.Tender = tender; _milestoneService.Create(milestone); _milestoneService.Save(); }
public void EditMilestone(MilestoneModel milestone) { var milestoneDb = unitOfWork.MilestoneRepository.GetByID(milestone.ID); milestoneDb.Name = milestone.Name; milestoneDb.EndDate = milestone.EndDate; unitOfWork.MilestoneRepository.Update(milestoneDb); unitOfWork.Save(); }
// PUT: api/Milestone/5 public void Put(int id, [FromBody] MilestoneModel value, int tenderId) { var milestone = _milestoneService.GetById(id, tenderId); var tender = _tenderService.GetTenderById(tenderId); Mapper.Map(value, milestone); _milestoneService.Update(milestone); _milestoneService.Save(); }
public IssueMilestonesFilterViewController(string user, string repo, bool alreadySelected) { Title = "Milestones".t(); NoItemsText = "No Milestones".t(); SearchPlaceholder = "Search Milestones".t(); ViewModel = new IssueMilestonesViewModel(user, repo); var clearMilestone = new MilestoneModel { Title = "Clear milestone filter".t() }; var noMilestone = new MilestoneModel { Title = "Issues with no milestone".t() }; var withMilestone = new MilestoneModel { Title = "Issues with milestone".t() }; //Add a fake 'Unassigned' guy so we can always unassigned what we've done ViewModel.BindCollection(x => x.Milestones, (ev) => { var items = ViewModel.Milestones.ToList(); items.Insert(0, noMilestone); items.Insert(1, withMilestone); if (alreadySelected) { items.Insert(0, clearMilestone); } RenderList(items, x => { return(new StyledStringElement(x.Title, () => { if (MilestoneSelected != null) { if (x == noMilestone) { MilestoneSelected(x.Title, null, "none"); } else if (x == withMilestone) { MilestoneSelected(x.Title, null, "*"); } else if (x == clearMilestone) { MilestoneSelected(null, null, null); } else { MilestoneSelected(x.Title, x.Number, x.Number.ToString()); } } })); }, ViewModel.Milestones.MoreItems); }); }
public async Task <IActionResult> AddMilestone() { MilestoneModel milestoneModel = new MilestoneModel(); var result = await this._repository.GetUsersAsync(3); milestoneModel.Users = result.Select(x => new SelectListItem { Text = x.FirstName + " " + x.LastName, Value = x.Id.ToString() }).ToList(); return(View(milestoneModel)); }
public MilestoneViewModel(int id, int projectid) { if (id == 0) { Milestone = new MilestoneModel() { Description = string.Empty, TargetDate = DateTime.Now.AddMonths(1), ProjectID = projectid }; IsEnabled = true; } else { Milestone = GetMilestone(id); SetUserAccessExistingMilestone(Milestone.CustomerID); } Milestone.PropertyChanged += Milestone_PropertyChanged; FullyObservableCollection <UserModel> associatess = GetUsers(); foreach (UserModel ag in associatess) { if (!ag.Deleted) { users.Add(new UserModel() { ID = ag.ID, Name = ag.Name, LoginName = ag.LoginName, Administrator = ag.Administrator }); } } canclearcompleteddate = Milestone.CompletedDate != null; if (id == 0) { WindowTitle = title; } else { WindowTitle = title + " (ID: " + id.ToString() + ", Project ID: " + projectid.ToString() + ")"; } Save = new RelayCommand(ExecuteSave, CanExecuteSave); CopyMilestone = new RelayCommand(ExecuteCopyMilestone, CanExecuteCopyMilestone); Cancel = new RelayCommand(ExecuteCancel, CanExecute); }
public IssueMilestonesFilterViewController(string user, string repo, bool alreadySelected) : base(true) { Style = MonoTouch.UIKit.UITableViewStyle.Plain; _username = user; _repository = repo; Title = "Milestones".t(); SearchPlaceholder = "Search Milestones".t(); var clearMilestone = new MilestoneModel { Title = "Clear milestone filter".t() }; var noMilestone = new MilestoneModel { Title = "Issues with no milestone".t() }; var withMilestone = new MilestoneModel { Title = "Issues with milestone".t() }; _milestones.CollectionChanged += (sender, e) => { var items = _milestones.ToList(); items.Insert(0, noMilestone); items.Insert(1, withMilestone); if (alreadySelected) items.Insert(0, clearMilestone); var sec = new Section(); foreach (var item in items) { var x = item; sec.Add(new StyledStringElement(x.Title, () => { if (MilestoneSelected != null) { if (x == noMilestone) MilestoneSelected(x.Title, null, "none"); else if (x == withMilestone) MilestoneSelected(x.Title, null, "*"); else if (x == clearMilestone) MilestoneSelected(null, null, null); else MilestoneSelected(x.Title, x.Number, x.Number.ToString()); } })); } InvokeOnMainThread(() => { Root = new RootElement(Title) { sec }; }); }; }
public async Task <IActionResult> AddMilestone(MilestoneModel milestoneModel) { //DateTime start = DateTime.ParseExact(milestoneModel.StartDate, "MM/dd/yyyy", CultureInfo.InvariantCulture); //DateTime expected = DateTime.ParseExact(milestoneModel.ExpectedDate, "MM/dd/yyyy", CultureInfo.InvariantCulture); //DateTime due = DateTime.ParseExact(milestoneModel.DueDate, "MM/dd/yyyy", CultureInfo.InvariantCulture); milestoneModel.CreatedBy = this.UserId; if (await this._repository.AddMilestoneAsync(milestoneModel)) { ModelState.Clear(); milestoneModel = new MilestoneModel(); ViewBag.Success = "Milestone has been added"; } else { ViewBag.Error = "There are error while saving"; } var result = await this._repository.GetUsersAsync(3); milestoneModel.Users = result.Select(x => new SelectListItem { Text = x.FirstName + " " + x.LastName, Value = x.Id.ToString() }).ToList(); return(View(milestoneModel)); }
public MilestoneElement(MilestoneModel m) : base(m.Name) { Milestone = m; }
public ActionResult getAllTask(string filter, Int64 ProjectId = 0) { List <MilestoneModel> Mlist = new List <MilestoneModel>(); List <MilestoneModel> Tlist = new List <MilestoneModel>(); PM_TaskBL tb = new PM_TaskBL(); var dt = tb.ToList(filter, string.Empty, string.Empty, ProjectId, 0); if (filter == "Get_Project_Tasks") { List <MilestoneModel> MyList = new List <MilestoneModel>(); foreach (var item in dt) { MilestoneModel mil = new MilestoneModel(); mil.PTaskId = Convert.ToInt64(item.PTaskId); mil.Task = item.Title; mil.TaskId = item.TaskId; MyList.Add(mil); } foreach (var item in MyList.Where(x => x.PTaskId == 0)) { MilestoneModel mil = new MilestoneModel(); mil.Tasks = FlatToHierarchy(MyList, item.TaskId); mil.TaskId = item.TaskId; mil.Task = item.Task; Mlist.Add(mil); } return(Json(Mlist, JsonRequestBehavior.AllowGet)); } if (dt.Count() > 0) { foreach (PM_Task obj in dt) { if (obj.PTaskId == "0") { MilestoneModel mil = new MilestoneModel(); mil.TaskId = Convert.ToInt64(obj.TaskId.ToString()); mil.PTaskId = Convert.ToInt64(obj.PTaskId.ToString()); mil.Task = obj.Title.ToString(); Mlist.Add(mil); } else { MilestoneModel tsk = new MilestoneModel(); tsk.TaskId = Convert.ToInt64(obj.TaskId.ToString()); tsk.PTaskId = Convert.ToInt64(obj.PTaskId.ToString()); tsk.Task = obj.Title.ToString(); Tlist.Add(tsk); } } foreach (var mile in Mlist) { foreach (var task in Tlist) { if (task.PTaskId == mile.TaskId) { mile.Tasks.Add(task); } } } } return(Json(Mlist, JsonRequestBehavior.AllowGet)); }
public MilestoneElement(MilestoneModel m) : base(m.Title) { Milestone = m; }
public IssueMilestonesFilterViewController(string user, string repo, bool alreadySelected) : base(true) { Style = MonoTouch.UIKit.UITableViewStyle.Plain; _username = user; _repository = repo; Title = "Milestones".t(); SearchPlaceholder = "Search Milestones".t(); var clearMilestone = new MilestoneModel { Title = "Clear milestone filter".t() }; var noMilestone = new MilestoneModel { Title = "Issues with no milestone".t() }; var withMilestone = new MilestoneModel { Title = "Issues with milestone".t() }; _milestones.CollectionChanged += (sender, e) => { var items = _milestones.ToList(); items.Insert(0, noMilestone); items.Insert(1, withMilestone); if (alreadySelected) { items.Insert(0, clearMilestone); } var sec = new Section(); foreach (var item in items) { var x = item; sec.Add(new StyledStringElement(x.Title, () => { if (MilestoneSelected != null) { if (x == noMilestone) { MilestoneSelected(x.Title, null, "none"); } else if (x == withMilestone) { MilestoneSelected(x.Title, null, "*"); } else if (x == clearMilestone) { MilestoneSelected(null, null, null); } else { MilestoneSelected(x.Title, x.Number, x.Number.ToString()); } } })); } InvokeOnMainThread(() => { Root = new RootElement(Title) { sec }; }); }; }
private static void OnMouseDoubleClick(object sender, MouseButtonEventArgs e) { Control control = sender as Control; ICommand command = (ICommand)control.GetValue(CommandProperty); object commandParameter = control.GetValue(CommandParameterProperty); if (sender is TreeViewItem) { if (!((TreeViewItem)sender).IsSelected) { return; } } IInputElement element = e.MouseDevice.DirectlyOver; if (element != null && element is FrameworkElement) { if (((FrameworkElement)element) is DataGridColumnHeader || ((FrameworkElement)element) is GridViewColumnHeader) { e.Handled = true; } else { if (sender is DataGrid) { if (sender is DataGrid grid && grid.SelectedItems != null && grid.SelectedItems.Count == 1) { if (grid.SelectedItem is DataRowView rowView) { DataRow row = rowView.Row; //do something with the underlying data //if (command.CanExecute(commandParameter)) //{ object[] values = new object[2]; values[0] = row["ProjectID"]; values[1] = commandParameter; command.Execute(values); //command.Execute(row["ProjectID"]); e.Handled = true; //} } } } else { if (sender is ListView lv && lv.SelectedItem != null && lv.SelectedItems.Count == 1) { if (lv.SelectedItem.GetType().Equals(typeof(MaintenanceModel))) { MaintenanceModel rowView = lv.SelectedItem as MaintenanceModel; if (rowView != null) { // ListViewItem row = rowView..Row; //do something with the underlying data //if (command.CanExecute(commandParameter)) //{ object[] values = new object[2]; values[0] = rowView.ProjectID; values[1] = commandParameter; command.Execute(values); //command.Execute(rowView.ProjectID); e.Handled = true; //} } } else if (lv.SelectedItem.GetType().Equals(typeof(EPModel))) { EPModel rowView = lv.SelectedItem as EPModel; if (rowView != null) { object[] values = new object[3]; values[0] = rowView.ProjectID; values[1] = rowView.ID; values[2] = commandParameter; command.Execute(values); e.Handled = true; } } else if (lv.SelectedItem.GetType().Equals(typeof(MilestoneModel))) { MilestoneModel rowView = lv.SelectedItem as MilestoneModel; if (rowView != null) { object[] values = new object[3]; values[0] = rowView.ProjectID; values[1] = rowView.ID; values[2] = commandParameter; command.Execute(values); e.Handled = true; } } } } //if (command.CanExecute(commandParameter)) //{ // command.Execute(commandParameter); // e.Handled = true; //} } } }
public IActionResult Update([FromBody] MilestoneModel milestone) { _milestoneService.EditMilestone(milestone); return(NoContent()); }
public MilestoneElement(MilestoneModel m) { Milestone = m; }
public SelectedMilestoneMessage(MilestoneModel milestone) { Milestone = milestone; }
private void PopulateRoot() { _title = new InputElement("Title", string.Empty, string.Empty); _assignedTo = new StyledStringElement("Responsible", Unassigned, UITableViewCellStyle.Value1); _assignedTo.Accessory = UITableViewCellAccessory.DisclosureIndicator; _assignedTo.Tapped += () => { var p = new IssueAssigneesViewController(Username, RepoSlug); p.SelectedUser = (x) => { _selectedAssignee = x; NavigationController.PopViewControllerAnimated(true); }; NavigationController.PushViewController(p, true); }; _milestone = new StyledStringElement("Milestone".t(), None, UITableViewCellStyle.Value1); _milestone.Accessory = UITableViewCellAccessory.DisclosureIndicator; _milestone.Tapped += () => { var p = new IssueMilestonesViewController(Username, RepoSlug); p.MilestoneSelected = (x) => { _selectedMilestone = x; NavigationController.PopViewControllerAnimated(true); }; NavigationController.PushViewController(p, true); }; _labels = new StyledStringElement("Labels".t(), None, UITableViewCellStyle.Value1); _labels.Accessory = UITableViewCellAccessory.DisclosureIndicator; _labels.Tapped += () => { var p = new IssueLabelsViewController(Username, RepoSlug) { SelectedLabels = _selectedLabels }; NavigationController.PushViewController(p, true); }; _state = new TrueFalseElement("Open", true); _content = new MultilinedElement("Description"); _content.Tapped += () => { var composer = new Composer { Title = "Issue Description", Text = _content.Value, ActionButtonText = "Save" }; composer.NewComment(this, (text) => { _content.Value = text; composer.CloseComposer(); }); }; var root = new RootElement(Title) { new Section { _title, _assignedTo, _milestone, _labels }, new Section { _content } }; //See if it's an existing issue or not... if (ExistingIssue != null) { _title.Value = ExistingIssue.Title; _selectedAssignee = ExistingIssue.Assignee; _selectedMilestone = ExistingIssue.Milestone; _selectedLabels = ExistingIssue.Labels; _content.Value = ExistingIssue.Body; _state.Value = ExistingIssue.State.Equals("open"); //Insert the status thing inbetween title and assigned to elements root.Insert(1, new Section() { _state }); } Root = root; }
public void AddMilestone(MilestoneModel milestone) { AddMilestone(new MilestoneViewModel(milestone)); }
public MilestoneViewModel(MilestoneModel milestone) { _milestone = milestone; }