public async void SaveInspectionClicked(object sender, EventArgs e) { ChecklistModel checklist = inspection.Checklist; //inspection.Name = NameCell.Text; inspection.ChecklistId = checklist.Id; if (!checklist.Inspections.Contains(inspection)) { checklist.Inspections.Add(inspection); } //if (inspectorPicker.SelectedIndex >= 0) //{ inspection.inspectors = selectedInspectors; inspection.inspectors.Remove(Inspector.Null); //inspection.inspectors.Add(inspectorPicker.SelectedItem); //} App.database.SaveInspection(inspection); CallingPage.ResetInspections(); if (!App.Navigation.NavigationStack.Contains(CallingPage)) { App.Navigation.InsertPageBefore(CallingPage, this); } await App.Navigation.PopAsync(true); }
internal void CheckForChecklists() { IEnumerable <string> zipFileNames = DependencyService.Get <IFileManage>().GetAllValidFiles(); if (zipFileNames.Any()) { List <ChecklistModel> newChecklists = new List <ChecklistModel>(); //List<string> zipNames = new List<string>(); foreach (string zipName in zipFileNames) { string unzippedDirectory = DependencyService.Get <IUnzipHelper>().Unzip(zipName); string xmlFile = DependencyService.Get <IFileManage>().GetXmlFile(unzippedDirectory); string checklistId = DependencyService.Get <IParseChecklist>().GetChecklistId(xmlFile); ChecklistModel model = ChecklistModel.Initialize(xmlFile); //move the files to a new folder. DependencyService.Get <IFileManage>().MoveDirectoryToPrivate(unzippedDirectory, checklistId); //Delete the zip file once we're done with it. DependencyService.Get <IFileManage>().DeleteFile(zipName); //zipNames.Add(zipName); //DependencyService.Get<IFileManage>().DeleteFile(zipName); newChecklists.Add(model); checklists.Add(model); } //Only delete the zip files if they get successfully saved to the db. Task.Run(async() => { await App.database.SaveChecklists(newChecklists); //foreach (string zipName in zipNames) //{ //} }); //App.database.SaveChecklists(newChecklists); ResetChecklists(); } }
public void Parse(ChecklistModel model, string filename) { Model = model; XmlReader reader = new FileManage().LoadXml(filename); XmlDocument document = new XmlDocument(); document.Load(reader); for (int i = 0; i < document.ChildNodes.Count; i++) { XmlNode node = document.ChildNodes[i]; if (node.NodeType != XmlNodeType.Element) { continue; } // pass node to the appropriate parsing function depending on its name if (node.Name == "Checklist") { ParseWholeChecklist(node); } else { //uh, this is bad and I don't know what ought to be done. TODO } } }
public ChecklistModel LoadChecklist(string id) { ChecklistModel checklist = database.Table <ChecklistModel>().SingleOrDefault(c => c.Id == id); database.GetChildren(checklist, true); return(checklist); }
public static async void CreateInspectionButtonClicked(object sender, EventArgs e) { CreateInspectionButton button = (CreateInspectionButton)sender; ChecklistModel checklist = button.checklist; EditInspectionPage page = new EditInspectionPage(null, checklist); page.CallingPage = (ChecklistPage)button.ParentView.ParentView; await App.Navigation.PushAsync(page); }
public InspectionPage(Inspection inspection) { this.inspection = inspection; Title = inspection.Name; /*ToolbarItem scoreButton = new ToolbarItem(); * scoreButton.Text = "Scores"; * //scoreButton.Icon = "ScoresIcon.png"; * scoreButton.Clicked += ClickScoresButton; * * ToolbarItem unansweredButton = new ToolbarItem(); * unansweredButton.Text = "Unanswered"; * unansweredButton.Clicked += ClickUnansweredButton; * ToolbarItem disputedButton = new ToolbarItem(); * disputedButton.Text = "Disputed"; * disputedButton.Clicked += ClickDisputedButton; * * ToolbarItem reportButton = new ToolbarItem(); * reportButton.Text = "Report"; * reportButton.Clicked += ClickReportButton;*/ ToolbarItem actionsButton = new ToolbarItem(); actionsButton.Text = "Actions"; actionsButton.Clicked += ClickActionsButton; //ToolbarItems.Add(scoreButton); //ToolbarItems.Add(unansweredButton); //ToolbarItems.Add(disputedButton); //ToolbarItems.Add(reportButton); ToolbarItems.Add(actionsButton); ChecklistModel checklist = inspection.Checklist; foreach (SectionModel section in checklist.Sections) { if (section.SectionParts.Count > 0) { SectionWithPartsPage page = new SectionWithPartsPage(section, inspection, this); Children.Add(page); } else { SectionNoPartsPage page = new SectionNoPartsPage(section, inspection, this); Children.Add(page); } } if (inspection.GetLastViewedQuestion() == null) { inspection.SetLastViewedQuestion(checklist.Sections.First().AllScorableQuestions().First()); } this.CurrentPageChanged += this.PageChanged; Question targetQuestion = inspection.GetLastViewedQuestion(); ISectionPage targetPage = SetSectionPage(targetQuestion.section); targetPage.Initialize(); targetPage.SetSelectedQuestion(targetQuestion); }
//public string ChecklistTitle { get; set; } public ChecklistPage(ChecklistModel checklist) { ToolbarItem inspectorButton = new ToolbarItem(); inspectorButton.Text = "Inspectors"; inspectorButton.Clicked += InspectorHelper.openInspectorsPage; ToolbarItems.Add(inspectorButton); Title = checklist.Title; this.checklist = checklist; ResetInspections(); }
public ActionResult SaveChecklist(ChecklistModel checklist, List <ChecklistDetailModel> checklistDetail) { if (checklist != null) { var validations = ValidationHelper.Validation(checklist, "checklist"); if (validations.Count > 0) { return(Json(new { Result = validations, Invalid = true }, JsonRequestBehavior.AllowGet)); } } checklist.CreatedBy = CurrentUser.UserId; checklist.UpdatedBy = CurrentUser.UserId; var checklistEntity = MapperHelper.Map <ChecklistModel, ChecklistEntity>(checklist); var checklistDetailType = MapperHelper.MapList <ChecklistDetailModel, Hrm.Repository.Type.ChecklistDetailType>(checklistDetail); var respone = _checklistService.SaveChecklist(checklistEntity, checklistDetailType); var result = new HrmResultModel <bool>(); var responeseResources = string.Empty; if (respone != null) { result = JsonConvert.DeserializeObject <HrmResultModel <bool> >(respone); if (!CheckPermission(result)) { //return to Access Denied } else { if (result.Success == true) { if (checklist.Id != 0) { responeseResources = _localizationService.GetResources("Message.Update.Successful"); } else { responeseResources = _localizationService.GetResources("Message.Create.Successful"); } } else { if (checklist.Id != 0) { responeseResources = _localizationService.GetResources("Message.Update.UnSuccessful"); } else { responeseResources = _localizationService.GetResources("Message.Create.UnSuccessfu"); } } } } return(Json(new { result, responeseResources }, JsonRequestBehavior.AllowGet)); }
//public string ChecklistTitle { get; set; } public InspectionListPage(ChecklistModel checklist) { ToolbarItem inspectorButton = new ToolbarItem(); inspectorButton.Text = "Inspectors"; inspectorButton.Clicked += InspectorHelper.openInspectorsPage; ToolbarItems.Add(inspectorButton); Title = "Inspection Listing"; NavigationPage.SetBackButtonTitle(this, "Inspection Listing"); this.checklist = checklist; ResetInspections(); }
public async void DeleteChecklist(object sender, EventArgs e) { BoundMenuItem <ChecklistModel> button = (BoundMenuItem <ChecklistModel>)sender; ChecklistModel checklist = button.BoundObject; bool answer = await DisplayAlert("Confirm Deletion", DependencyService.Get <IValuesHelper>().deleteChecklistWarning(checklist.Title), "Yes", "No"); if (!answer) { return; } ChecklistModel.DeleteChecklist(checklist); checklists.Remove(checklist); ResetChecklists(); }
public static Color GetScoreColor(double score, ChecklistModel checklist, bool allowCommendable = true) { double percentScore = score * 100; if (percentScore < checklist.ScoreThresholdSatisfactory) { return(Color.Red); } else if (percentScore < checklist.ScoreThresholdCommendable || !allowCommendable) { return(Color.Green); } else { return(Color.Blue); } }
public static async void CreateInspectionButtonClicked(object sender, EventArgs e) { CreateInspectionButton button = (CreateInspectionButton)sender; ChecklistModel checklist = button.checklist; EditInspectionPage page = new EditInspectionPage(null, checklist); VisualElement Parent = button.ParentView.ParentView; if (Parent.GetType() == typeof(InspectionListPage)) { page.CallingPage = (InspectionListPage)button.ParentView.ParentView; } else { InspectionListPage ListPage = new InspectionListPage(checklist); page.CallingPage = ListPage; } await App.Navigation.PushAsync(page); }
public ActionResult Edit(ChecklistModel newChecklist) { try { if (ModelState.IsValid) { _checklistDao.Update(newChecklist); return(RedirectToAction("List")); } } catch (Exception ex) { ModelState.AddModelError("Exception", ex); } ViewBag.FormMode = "Edit"; return(View("Edit", newChecklist)); }
public ReferenceListPage(ChecklistModel checklist) { this.checklist = checklist; Title = "Reference List"; TableView view = new TableView(); TableRoot root = new TableRoot(); TableSection section = new TableSection(); List <Reference> references = new List <Reference>(); foreach (List <Reference> questionReferences in checklist.GetAllQuestions().Select(q => q.References)) { references.AddRange(questionReferences); } //folderName + "/" + reference.DocumentName; IEnumerable <string> fileNames = references.Select(r => r.DocumentName).Distinct(); foreach (string fileName in fileNames) { ViewCell cell = new ViewCell(); StackLayout layout = new StackLayout(); layout.Padding = new Thickness(10, 0, 0, 0); Button button = new Button(); button.Text = removeFileExtension(fileName); button.HorizontalOptions = LayoutOptions.StartAndExpand; button.Clicked += async(object Sender, EventArgs e) => { string folderName = checklist.Id; string relativePath = folderName + "/" + fileName; ReferencePage page = new ReferencePage(relativePath, 1); await App.Navigation.PushAsync(page); }; layout.Children.Add(button); cell.View = layout; section.Add(cell); } root.Add(section); view.Root = root; Content = view; }
public async Task <IActionResult> Create(CreateChecklistViewModel CreateChecklistModel) { if (CreateChecklistModel.ChecklistLineItems.Count > 0) { ChecklistModel Checklist = new ChecklistModel { ChecklistTitle = CreateChecklistModel.Title }; _context.Add(Checklist); _context.SaveChanges(); foreach (string ActionToDo in CreateChecklistModel.ChecklistLineItems) { ChecklistLineItemModel LineItem = new ChecklistLineItemModel { ActionToDo = ActionToDo }; _context.Add(LineItem); _context.SaveChanges(); LineItemJoinerModel LineItemJoiner = new LineItemJoinerModel { ChecklistId = Checklist.CheckListId, ChecklistLineItemId = LineItem.ChecklistLineItemId }; _context.Add(LineItemJoiner); _context.SaveChanges(); UserChecklistModel UserChecklist = new UserChecklistModel { User = await _userManager.GetUserAsync(HttpContext.User), LineItemJoinerId = LineItemJoiner.LineItemJoinerId }; _context.Add(UserChecklist); _context.SaveChanges(); } await _context.SaveChangesAsync(); return(RedirectToAction("Index", "UserChecklist")); } return(View(CreateChecklistModel)); }
public void ExportInspection(Inspection inspection, string filename) { this.inspection = inspection; checklist = inspection.Checklist; string fullPath = Path.Combine(new FileManage().GetPublicFolder(), filename); XmlTextWriter writer = new XmlTextWriter(fullPath, null); writer.Formatting = Formatting.Indented; writer.Indentation = 1; writer.IndentChar = '\t'; writer.WriteStartDocument(); writer.WriteComment(" Generated by the Checklist Compiler Program version " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version + " "); writer.WriteComment(" Safety Research Corporation of America - http://www.srca.net/ "); // start checklist writer.WriteStartElement("Checklist"); writer.WriteAttributeString("Id", checklist.Id); writer.WriteAttributeString("Title", checklist.Title); writer.WriteAttributeString("Description", checklist.Description); writer.WriteAttributeString("ContactName", checklist.ContactName); writer.WriteAttributeString("ContactPosition", checklist.ContactPosition); writer.WriteAttributeString("ContactAddress", checklist.ContactAddress); writer.WriteAttributeString("ContactCityState", checklist.ContactCityState); writer.WriteAttributeString("ContactZip", checklist.ContactZip); writer.WriteAttributeString("ScoreThresholdCommendable", checklist.ScoreThresholdCommendable.ToString()); writer.WriteAttributeString("ScoreThresholdSatisfactory", checklist.ScoreThresholdSatisfactory.ToString()); writer.WriteAttributeString("UserInvert", checklist.UserInvert.ToString()); writer.WriteAttributeString("InspectionTitle", inspection.Name); writer.WriteAttributeString("Organization", inspection.Organization); SaveInspectors(writer); //SaveSystemicDefCategories(writer); I don't actually know what this is. SaveSections(writer); // end checklist writer.WriteEndDocument(); writer.Close(); }
/// <summary> /// Saves the checklist to the database, calling section and question saves recursively. /// </summary> /// <param name="checklist">The checklist to be saved to the database.</param> /*public static void SaveChecklistToDatabase(ChecklistModel checklist) * { * DatabaseAccess database = App.database; * database.SaveChecklist(checklist); * /*foreach (Section section in checklist.Sections) * { * section.checklist = checklist; * section.ChecklistId = checklist.Id; * database.SaveSection(section); * foreach (SectionPart part in section.SectionParts) * { * part.section = section; * part.SectionId = section.Id; * database.SavePart(part); * foreach (Question question in part.Questions) * { * question.part = part; * question.SectionPartId = part.Id; * question.section = section; * question.SectionId = section.Id; * database.SaveQuestion(question); * } * } * foreach (Question question in section.Questions) * { * question.section = section; * question.SectionId = section.Id; * database.SaveQuestion(question); * } * }*//* * }*/ public static ChecklistModel LoadChecklistDetails(string checklistId) { DatabaseAccess database = App.database; ChecklistModel checklist = database.LoadChecklist(checklistId); /*checklist.Inspections = database.LoadInspectionsForChecklist(checklistId).ToList(); * checklist.Sections = database.LoadSectionsForChecklist(checklistId).ToList(); * foreach (Section section in checklist.Sections) * { * section.SectionParts = database.LoadPartsForSection(section.Id).ToList(); * if (section.SectionParts.Count == 0) * { * section.Questions = database.LoadQuestionsForSection(section.Id).ToList(); * } * else * { * foreach (SectionPart part in section.SectionParts) * { * part.Questions = database.LoadQuestionsForPart(part.Id).ToList(); * } * } * }*/ return(checklist); }
public CreateInspectionButton(ChecklistModel checklist) { this.checklist = checklist; }
public async Task <OpportunityViewModel> OpportunityToViewModelAsync(Opportunity entity, string requestId = "") { var oppId = entity.Id; try { //var entityDto = TinyMapper.Map<OpportunityViewModel>(entity); var viewModel = new OpportunityViewModel { Id = entity.Id, DisplayName = entity.DisplayName, Reference = entity.Reference, Version = entity.Version, OpportunityState = OpportunityStateModel.FromValue(entity.Metadata.OpportunityState.Value), DealSize = entity.Metadata.DealSize, AnnualRevenue = entity.Metadata.AnnualRevenue, OpenedDate = entity.Metadata.OpenedDate, Industry = new IndustryModel { Name = entity.Metadata.Industry.Name, Id = entity.Metadata.Industry.Id }, Region = new RegionModel { Name = entity.Metadata.Region.Name, Id = entity.Metadata.Region.Id }, Margin = entity.Metadata.Margin, Rate = entity.Metadata.Rate, DebtRatio = entity.Metadata.DebtRatio, Purpose = entity.Metadata.Purpose, DisbursementSchedule = entity.Metadata.DisbursementSchedule, CollateralAmount = entity.Metadata.CollateralAmount, Guarantees = entity.Metadata.Guarantees, RiskRating = entity.Metadata.RiskRating, OpportunityChannelId = entity.Metadata.OpportunityChannelId, Customer = new CustomerModel { DisplayName = entity.Metadata.Customer.DisplayName, Id = entity.Metadata.Customer.Id, ReferenceId = entity.Metadata.Customer.ReferenceId }, TeamMembers = new List <TeamMemberModel>(), Notes = new List <NoteModel>(), Checklists = new List <ChecklistModel>(), CustomerDecision = new CustomerDecisionModel { Id = entity.Content.CustomerDecision.Id, Approved = entity.Content.CustomerDecision.Approved, ApprovedDate = entity.Content.CustomerDecision.ApprovedDate, LoanDisbursed = entity.Content.CustomerDecision.LoanDisbursed } }; viewModel.ProposalDocument = new ProposalDocumentModel(); viewModel.ProposalDocument.Id = entity.Content.ProposalDocument.Id; viewModel.ProposalDocument.DisplayName = entity.Content.ProposalDocument.DisplayName; viewModel.ProposalDocument.Reference = entity.Content.ProposalDocument.Reference; viewModel.ProposalDocument.DocumentUri = entity.Content.ProposalDocument.Metadata.DocumentUri; viewModel.ProposalDocument.Category = new CategoryModel(); viewModel.ProposalDocument.Category.Id = entity.Content.ProposalDocument.Metadata.Category.Id; viewModel.ProposalDocument.Category.Name = entity.Content.ProposalDocument.Metadata.Category.Name; viewModel.ProposalDocument.Content = new ProposalDocumentContentModel(); viewModel.ProposalDocument.Content.ProposalSectionList = new List <DocumentSectionModel>(); viewModel.ProposalDocument.Notes = new List <NoteModel>(); viewModel.ProposalDocument.Tags = entity.Content.ProposalDocument.Metadata.Tags; viewModel.ProposalDocument.Version = entity.Content.ProposalDocument.Version; // Checklists foreach (var item in entity.Content.Checklists) { var checklistTasks = new List <ChecklistTaskModel>(); foreach (var subitem in item.ChecklistTaskList) { var checklistItem = new ChecklistTaskModel { Id = subitem.Id, ChecklistItem = subitem.ChecklistItem, Completed = subitem.Completed, FileUri = subitem.FileUri }; checklistTasks.Add(checklistItem); } var checklistModel = new ChecklistModel { Id = item.Id, ChecklistStatus = item.ChecklistStatus, ChecklistTaskList = checklistTasks, ChecklistChannel = item.ChecklistChannel }; viewModel.Checklists.Add(checklistModel); } // TeamMembers foreach (var item in entity.Content.TeamMembers.ToList()) { var memberModel = new TeamMemberModel(); memberModel.Status = item.Status; memberModel.AssignedRole = await _userProfileHelpers.RoleToViewModelAsync(item.AssignedRole, requestId); memberModel.Id = item.Id; memberModel.DisplayName = item.DisplayName; memberModel.Mail = item.Fields.Mail; memberModel.UserPrincipalName = item.Fields.UserPrincipalName; memberModel.Title = item.Fields.Title ?? String.Empty; viewModel.TeamMembers.Add(memberModel); } // Notes foreach (var item in entity.Content.Notes.ToList()) { var note = new NoteModel(); note.Id = item.Id; var userProfile = new UserProfileViewModel(); userProfile.Id = item.CreatedBy.Id; userProfile.DisplayName = item.CreatedBy.DisplayName; userProfile.Mail = item.CreatedBy.Fields.Mail; userProfile.UserPrincipalName = item.CreatedBy.Fields.UserPrincipalName; userProfile.UserRoles = await _userProfileHelpers.RolesToViewModelAsync(item.CreatedBy.Fields.UserRoles, requestId); note.CreatedBy = userProfile; note.NoteBody = item.NoteBody; note.CreatedDateTime = item.CreatedDateTime; viewModel.Notes.Add(note); } // ProposalDocument Notes foreach (var item in entity.Content.ProposalDocument.Metadata.Notes.ToList()) { var docNote = new NoteModel(); docNote.Id = item.Id; docNote.CreatedDateTime = item.CreatedDateTime; docNote.NoteBody = item.NoteBody; docNote.CreatedBy = new UserProfileViewModel { Id = item.CreatedBy.Id, DisplayName = item.CreatedBy.DisplayName, Mail = item.CreatedBy.Fields.Mail, UserPrincipalName = item.CreatedBy.Fields.UserPrincipalName, UserRoles = await _userProfileHelpers.RolesToViewModelAsync(item.CreatedBy.Fields.UserRoles, requestId) }; viewModel.ProposalDocument.Notes.Add(docNote); } // ProposalDocument ProposalSectionList foreach (var item in entity.Content.ProposalDocument.Content.ProposalSectionList.ToList()) { if (!String.IsNullOrEmpty(item.Id)) { var docSectionModel = new DocumentSectionModel(); docSectionModel.Id = item.Id; docSectionModel.DisplayName = item.DisplayName; docSectionModel.LastModifiedDateTime = item.LastModifiedDateTime; docSectionModel.Owner = new UserProfileViewModel(); if (item.Owner != null) { docSectionModel.Owner.Id = item.Owner.Id ?? String.Empty; docSectionModel.Owner.DisplayName = item.Owner.DisplayName ?? String.Empty; if (item.Owner.Fields != null) { docSectionModel.Owner.Mail = item.Owner.Fields.Mail ?? String.Empty; docSectionModel.Owner.UserPrincipalName = item.Owner.Fields.UserPrincipalName ?? String.Empty; docSectionModel.Owner.UserRoles = new List <RoleModel>(); if (item.Owner.Fields.UserRoles != null) { docSectionModel.Owner.UserRoles = await _userProfileHelpers.RolesToViewModelAsync(item.Owner.Fields.UserRoles, requestId); } } else { docSectionModel.Owner.Mail = String.Empty; docSectionModel.Owner.UserPrincipalName = String.Empty; docSectionModel.Owner.UserRoles = new List <RoleModel>(); if (item.Owner.Fields.UserRoles != null) { docSectionModel.Owner.UserRoles = await _userProfileHelpers.RolesToViewModelAsync(item.Owner.Fields.UserRoles, requestId); } } } docSectionModel.SectionStatus = item.SectionStatus; docSectionModel.SubSectionId = item.SubSectionId; docSectionModel.AssignedTo = new UserProfileViewModel(); if (item.AssignedTo != null) { docSectionModel.AssignedTo.Id = item.AssignedTo.Id; docSectionModel.AssignedTo.DisplayName = item.AssignedTo.DisplayName; docSectionModel.AssignedTo.Mail = item.AssignedTo.Fields.Mail; docSectionModel.AssignedTo.Title = item.AssignedTo.Fields.Title; docSectionModel.AssignedTo.UserPrincipalName = item.AssignedTo.Fields.UserPrincipalName; // TODO: Not including role info since it is not relevant but if needed it needs to be set here } docSectionModel.Task = item.Task; viewModel.ProposalDocument.Content.ProposalSectionList.Add(docSectionModel); } } // DocumentAttachments viewModel.DocumentAttachments = new List <DocumentAttachmentModel>(); if (entity.DocumentAttachments != null) { foreach (var itm in entity.DocumentAttachments) { var doc = new DocumentAttachmentModel(); doc.Id = itm.Id ?? String.Empty; doc.FileName = itm.FileName ?? String.Empty; doc.Note = itm.Note ?? String.Empty; doc.Tags = itm.Tags ?? String.Empty; doc.Category = new CategoryModel(); doc.Category.Id = itm.Category.Id; doc.Category.Name = itm.Category.Name; doc.DocumentUri = itm.DocumentUri; viewModel.DocumentAttachments.Add(doc); } } return(viewModel); } catch (Exception ex) { // TODO: _logger.LogError("MapToViewModelAsync error: " + ex); throw new ResponseException($"RequestId: {requestId} - OpportunityToViewModelAsync oppId: {oppId} - failed to map opportunity: {ex}"); } }
public EditInspectionPage(Inspection existingInspection = null, ChecklistModel checklist = null) { /*ToolbarItem inspectorButton = new ToolbarItem(); * inspectorButton.Text = "Inspectors"; * inspectorButton.Clicked += InspectorHelper.openInspectorsPage; * ToolbarItems.Add(inspectorButton);*/ Padding = new Thickness(0, 5, 0, 0); Title = "Inspection Information"; if (existingInspection == null) { inspection = new Inspection(); inspection.Checklist = checklist; inspection.ChecklistId = checklist.Id; selectedInspectors = new List <Inspector>(); } else { inspection = existingInspection; selectedInspectors = new List <Inspector>(inspection.inspectors); } TableView view = new TableView(); TableRoot root = new TableRoot("Inspection Information"); TableSection section = new TableSection(); StackLayout layout = new StackLayout(); Grid valuesGrid = new Grid { Padding = new Thickness(5, 0, 0, 15), ColumnDefinitions = { new ColumnDefinition { Width = GridLength.Auto }, new ColumnDefinition { Width = GridLength.Auto } }, RowDefinitions = { new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, } }; int rowNumber = 0; valuesGrid.Children.Add(new Label { Text = "Inspection Name:" }, 0, rowNumber); /*StackLayout nameLayout = new StackLayout * { * Orientation = StackOrientation.Horizontal, * Children = { * new Label{ * Text = "Inspection Name:" * } * } * };*/ Entry nameEntry = new Entry(); nameEntry.WidthRequest = 300; nameEntry.BindingContext = inspection; nameEntry.SetBinding(Entry.TextProperty, "Name"); valuesGrid.Children.Add(nameEntry, 1, rowNumber); rowNumber++; //nameLayout.Children.Add(nameEntry); /*EntryCell NameCell = new EntryCell * { * BindingContext = inspection, * Label = "Inspection Name:", * }; * NameCell.SetBinding(EntryCell.TextProperty, "Name"); * * EntryCell OrganizationCell = new EntryCell * { * BindingContext = inspection, * Label = "Organization:", * }; * OrganizationCell.SetBinding(EntryCell.TextProperty, "Organization");*/ /*StackLayout orgLayout = new StackLayout * { * Orientation = StackOrientation.Horizontal, * Children = { * new Label{ * Text = "Organization:" * } * } * };*/ Entry orgEntry = new Entry(); orgEntry.BindingContext = inspection; orgEntry.SetBinding(Entry.TextProperty, "Organization"); orgEntry.WidthRequest = 300; //orgLayout.Children.Add(orgEntry); valuesGrid.Children.Add(new Label { Text = "Organization Inspected:" }, 0, rowNumber); valuesGrid.Children.Add(orgEntry, 1, rowNumber); rowNumber++; Entry PocEntry = new Entry(); PocEntry.BindingContext = inspection; PocEntry.SetBinding(Entry.TextProperty, "Poc"); PocEntry.WidthRequest = 300; valuesGrid.Children.Add(new Label { Text = "POC:" }, 0, rowNumber); valuesGrid.Children.Add(PocEntry, 1, rowNumber); rowNumber++; Entry PocPhoneEntry = new Entry(); PocPhoneEntry.BindingContext = inspection; PocPhoneEntry.SetBinding(Entry.TextProperty, "PocPhone"); PocPhoneEntry.WidthRequest = 300; valuesGrid.Children.Add(new Label { Text = "POC Phone:" }, 0, rowNumber); valuesGrid.Children.Add(PocPhoneEntry, 1, rowNumber); rowNumber++; /*StackLayout dateLayout = new StackLayout * { * Orientation = StackOrientation.Horizontal, * Children = { * new Label{ * Text = "Inspection Date: " * } * } * };*/ if (inspection.Date == null) { inspection.Date = DateTime.Now; } DatePicker datePicker = new DatePicker { BindingContext = inspection, }; datePicker.SetBinding(DatePicker.DateProperty, "Date"); //dateLayout.Children.Add(datePicker); valuesGrid.Children.Add(new Label { Text = "Inspection Date:" }, 0, rowNumber); valuesGrid.Children.Add(datePicker, 1, rowNumber); rowNumber++; if (inspection.CompletedDate == null) { inspection.CompletedDate = DateTime.Now; } DatePicker completedPicker = new DatePicker { BindingContext = inspection }; completedPicker.SetBinding(DatePicker.DateProperty, "CompletedDate"); valuesGrid.Children.Add(new Label { Text = "Date Completed:" }, 0, rowNumber); valuesGrid.Children.Add(completedPicker, 1, rowNumber); rowNumber++; /*nameLayout.Padding = new Thickness(5, 0, 0, 0); * orgLayout.Padding = new Thickness(5, 0, 0, 0); * dateLayout.Padding = new Thickness(5, 0, 0, 0);*/ //inspectorPicker = new GenericPicker<Inspector>(); availableInspectors = App.database.LoadAllInspectors(); availableInspectors.Add(Inspector.Null); foreach (Inspector selectedInspector in selectedInspectors) { availableInspectors.RemoveAll(i => i.Id == selectedInspector.Id); } selectedInspectors.Add(Inspector.Null); //foreach (Inspector inspector in availableInspectors) //{ // inspectorPicker.AddItem(inspector); //} /*if (inspection.inspectors.Any()) * { * try * { * inspectorPicker.SelectedItem = inspection.inspectors.First(); * } * catch (KeyNotFoundException) { } * }*/ //ViewCell inspectorCell = new ViewCell { View = inspectorPicker }; //ViewCell inspectorsCell = new ViewCell(); StackLayout inspectorsLayout = new StackLayout { Orientation = StackOrientation.Horizontal, Padding = new Thickness(5, 0), }; StackLayout availableLayout = new StackLayout(); Rectangle bounds = App.GetPageBounds(); availableLayout.WidthRequest = (bounds.Width / 2) - 5; availableLayout.HeightRequest = 400; StackLayout selectedLayout = new StackLayout(); selectedLayout.WidthRequest = (bounds.Width / 2) - 5; selectedLayout.HeightRequest = 400; Label availableLabel = new Label { Text = "Available Inspectors" }; Label selectedLabel = new Label { Text = "Selected Inspectors" }; availableLayout.Children.Add(availableLabel); selectedLayout.Children.Add(selectedLabel); inspectorsLayout.Children.Add(availableLayout); inspectorsLayout.Children.Add(selectedLayout); //inspectorsCell.View = inspectorsLayout; availableListView = CreateInspectorsListView(availableInspectors); selectedListView = CreateInspectorsListView(selectedInspectors); availableLayout.Children.Add(availableListView); selectedLayout.Children.Add(selectedListView); //ViewCell SaveCell = new ViewCell(); //ViewCell CancelCell = new ViewCell(); Button saveButton = new Button(); //Button cancelButton = new Button(); saveButton.Clicked += SaveInspectionClicked; //cancelButton.Clicked += CancelInspectionClicked; saveButton.Text = "Save"; //cancelButton.Text = "Cancel"; //SaveCell.View = saveButton; //CancelCell.View = cancelButton; Button createInspectorsButton = new Button(); createInspectorsButton.Text = "New Inspector"; createInspectorsButton.Clicked += openCreateInspectorPage; //section.Add(NameCell); //section.Add(OrganizationCell); //section.Add(inspectorCell); //section.Add(inspectorsCell); //section.Add(SaveCell); /*layout.Children.Add(nameLayout); * layout.Children.Add(orgLayout); * layout.Children.Add(dateLayout);*/ layout.Children.Add(valuesGrid); layout.Children.Add(inspectorsLayout); layout.Children.Add(createInspectorsButton); layout.Children.Add(saveButton); //section.Add(CancelCell); root.Add(section); view.Root = root; //view.Intent = TableIntent.Form; //view.HasUnevenRows = true; Content = layout; //Content = view; }
public async Task <IActionResult> CreateOpportunityAsync(string @event, [FromBody] JObject data) { if (!string.IsNullOrWhiteSpace(@event) && @event.Equals("create", StringComparison.InvariantCultureIgnoreCase)) { try { var jopp = data["InputParameters"].First()["value"]["Attributes"]; var attributes = jopp.ToDictionary(p => p["key"], v => v["value"]); var opportunityMapping = dynamicsConfiguration.OpportunityMapping; var opportunityName = GetAttribute(attributes, opportunityMapping.DisplayName)?.ToString(); var opportunityId = GetAttribute(attributes, "opportunityid").ToString(); var creator = dynamicsLinkService.GetUserData(data["InitiatingUserId"].ToString()); var creatorRole = proposalManagerConfiguration.CreatorRole; var opp = new OpportunityViewModel { Reference = opportunityId, DisplayName = opportunityName, OpportunityState = OpportunityStateModel.FromValue(opportunityMapping.MapStatusCode((int)GetAttribute(attributes, "statuscode")["Value"])), Customer = new CustomerModel { DisplayName = dynamicsLinkService.GetAccountName(GetAttribute(attributes, "customerid")?["Id"].ToString()) }, DealSize = (double?)GetAttribute(attributes, opportunityMapping.DealSize) ?? 0, AnnualRevenue = (double?)GetAttribute(attributes, opportunityMapping.AnnualRevenue) ?? 0, OpenedDate = DateTimeOffset.TryParse(GetAttribute(attributes, opportunityMapping.OpenedDate)?.ToString(), out var dto) ? dto : DateTimeOffset.Now, Margin = (double?)GetAttribute(attributes, opportunityMapping.Margin) ?? 0, Rate = (double?)GetAttribute(attributes, opportunityMapping.Rate) ?? 0, DebtRatio = (double?)GetAttribute(attributes, opportunityMapping.DebtRatio) ?? 0, Purpose = GetAttribute(attributes, opportunityMapping.Purpose)?.ToString(), DisbursementSchedule = GetAttribute(attributes, opportunityMapping.DisbursementSchedule)?.ToString(), CollateralAmount = (double?)GetAttribute(attributes, opportunityMapping.CollateralAmount) ?? 0, Guarantees = GetAttribute(attributes, opportunityMapping.Guarantees)?.ToString(), RiskRating = (int?)GetAttribute(attributes, opportunityMapping.RiskRating) ?? 0, TeamMembers = new TeamMemberModel[] { new TeamMemberModel { DisplayName = creator.DisplayName, Id = creator.Id, Mail = creator.Email, UserPrincipalName = creator.Email, AssignedRole = new RoleModel { AdGroupName = creatorRole.AdGroupName, DisplayName = creatorRole.DisplayName, Id = creatorRole.Id } } }, Checklists = new ChecklistModel[] { } }; var proposalManagerClient = await proposalManagerClientFactory.GetProposalManagerClientAsync(); var userProfileResult = await proposalManagerClient.GetAsync($"/api/UserProfile?upn={creator.Email}"); var userProfile = JsonConvert.DeserializeObject <UserProfileViewModel>(await userProfileResult.Content.ReadAsStringAsync()); if (!userProfile.UserRoles.Any(ur => ur.AdGroupName == creatorRole.AdGroupName)) { return(BadRequest($"{creator.Email} is not a member of role {creatorRole.AdGroupName}.")); } var remoteEndpoint = $"/api/Opportunity"; var result = await proposalManagerClient.PostAsync(remoteEndpoint, new StringContent(JsonConvert.SerializeObject(opp), Encoding.UTF8, "application/json")); if (result.IsSuccessStatusCode) { await dynamicsLinkService.CreateTemporaryLocationForOpportunityAsync(opportunityId, opportunityName); return(Ok()); } else { _logger.LogError("DYNAMICS INTEGRATION ENGINE: Proposal Manager did not return a success status code."); return(BadRequest()); } } catch (Exception ex) { _logger.LogError(ex.Message); _logger.LogError(ex.StackTrace); return(BadRequest()); } } return(BadRequest($"{nameof(@event)} is required")); }
public ChecklistMenuPage(ChecklistModel checklist) { this.checklist = checklist; Title = "Checklist Options"; TableView view = new TableView(); TableRoot root = new TableRoot(); TableSection section = new TableSection(); view.Intent = TableIntent.Menu; //New Inspection ViewCell newInspectionCell = new ViewCell(); StackLayout newInspectionLayout = new StackLayout { Padding = new Thickness(20, 0, 0, 0) }; CreateInspectionButton newInspectionButton = new CreateInspectionButton(checklist); newInspectionButton.HorizontalOptions = LayoutOptions.StartAndExpand; newInspectionButton.Clicked += InspectionHelper.CreateInspectionButtonClicked; newInspectionButton.Text = "Begin a New Inspection"; newInspectionLayout.Children.Add(newInspectionButton); newInspectionCell.View = newInspectionLayout; //Existing Inspection ViewCell existingInspectionCell = new ViewCell(); StackLayout existingInspectionLayout = new StackLayout { Padding = new Thickness(20, 0, 0, 0) }; ChecklistButton existingInspectionButton = new ChecklistButton(); existingInspectionButton.HorizontalOptions = LayoutOptions.StartAndExpand; existingInspectionButton.checklist = checklist; existingInspectionButton.Text = "Continue an Existing Inspection"; existingInspectionButton.Clicked += ChecklistHelper.InspectionListButtonClicked; existingInspectionLayout.Children.Add(existingInspectionButton); existingInspectionCell.View = existingInspectionLayout; //View References ViewCell viewReferencesCell = new ViewCell(); StackLayout viewReferencesLayout = new StackLayout { Padding = new Thickness(20, 0, 0, 0) }; ChecklistButton viewReferencesButton = new ChecklistButton(); viewReferencesButton.HorizontalOptions = LayoutOptions.StartAndExpand; viewReferencesButton.checklist = checklist; viewReferencesButton.Text = "View References"; viewReferencesButton.Clicked += ChecklistHelper.ReferenceListButtonClicked; viewReferencesLayout.Children.Add(viewReferencesButton); viewReferencesCell.View = viewReferencesLayout; //Full Reference List /*ViewCell referenceListCell = new ViewCell(); * Label referenceListLabel = new Label(); * referenceListLabel.Text = "View Full Reference List"; * referenceListCell.View = referenceListLabel;*/ section.Add(newInspectionCell); section.Add(existingInspectionCell); section.Add(viewReferencesCell); //section.Add(referenceListCell); root.Add(section); view.Root = root; Content = view; }
public ScoresPage(Inspection inspection, Question initialQuestion) { this.inspection = inspection; ChecklistModel checklist = inspection.Checklist; scoresThreshold = new Threshold(checklist.ScoreThresholdCommendable, checklist.ScoreThresholdSatisfactory); Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0); this.Title = "Scores"; ScoresLayout layout = new ScoresLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center }; Label label = new Label { Text = "Choose section and part to see scores" }; //add all the other stuff. GenericPicker <SectionModel> sectionPicker = new GenericPicker <SectionModel>(); foreach (SectionModel section in inspection.Checklist.Sections) { sectionPicker.AddItem(section); } partPicker = new GenericPicker <SectionPart>(); foreach (SectionPart part in initialQuestion.section.SectionParts) { partPicker.AddItem(part); } Button backButton = new Button { Text = "Back" }; sectionScoreLabel = new Label { Text = "Section label", TextColor = Color.White }; partScoreLabel = new Label { Text = "Part label", TextColor = Color.White }; backButton.Clicked += BackButtonClicked; layout.Children.Add(label); layout.Children.Add(sectionPicker); layout.Children.Add(sectionScoreLabel); layout.Children.Add(partPicker); layout.Children.Add(partScoreLabel); double cumulativeScore = ScoringHelper.ScoreInspection(inspection).Item3; Label cumulativeScoreLabel = new Label { Text = "Cumulative Score: " + (cumulativeScore * 100).ToString("0.00") + "%", TextColor = Color.White }; setScoresColor(cumulativeScore, cumulativeScoreLabel); layout.Children.Add(cumulativeScoreLabel); layout.Children.Add(backButton); this.Content = layout; sectionPicker.SelectedIndexChanged += ChangeSection; sectionPicker.SelectedIndex = sectionPicker.TItems.IndexOf(initialQuestion.section); partPicker.SelectedIndexChanged += ChangePart; if (initialQuestion.part != null) { partPicker.SelectedIndex = partPicker.TItems.IndexOf(initialQuestion.part); } }
public void Update(ChecklistModel checklist) { DataContext.Update(TableName, IdColumn, new { Id = checklist.Id, Name = checklist.Name, ModifiedDate = DateTime.Now }); }
public void DeleteChecklist(ChecklistModel checklist) { database.DeleteAll(checklist.GetAllQuestions()); database.Delete(checklist); }
public async Task <OpportunityViewModel> MapToModelAsync(Opportunity entity, OpportunityViewModel viewModel, string requestId = "") { try { foreach (var item in entity.Content.Checklists) { var overrideAccess = _authorizationService.GetGranularAccessOverride(); //Granular Access : Start var list = new List <string>() { Access.Opportunities_Read_All.ToString(), Access.Opportunities_ReadWrite_All.ToString() }; var access = true; //going for super access var permissionsNeeded = (await _permissionRepository.GetAllAsync(requestId)).ToList().Where(x => list.Any(x.Name.Contains)).ToList(); if (!(StatusCodes.Status200OK == await _authorizationService.CheckAccessAsync(permissionsNeeded, requestId))) { //going for opportunity access access = await _authorizationService.CheckAccessInOpportunityAsync(entity, PermissionNeededTo.Read, requestId); if (!access) { //going for partial accesss access = await _authorizationService.CheckAccessInOpportunityAsync(entity, PermissionNeededTo.ReadPartial, requestId); if (access) { var channel = item.ChecklistChannel.Replace(" ", ""); List <string> partialList = new List <string>() { $"{channel.ToLower()}_read", $"{channel.ToLower()}_readwrite" }; permissionsNeeded = (await _permissionRepository.GetAllAsync(requestId)).ToList().Where(x => partialList.Any(x.Name.ToLower().Contains)).ToList(); access = StatusCodes.Status200OK == await _authorizationService.CheckAccessAsync(permissionsNeeded, requestId) ? true : false; } else { access = false; } } } if (access || overrideAccess) { var checklistTasks = new List <ChecklistTaskModel>(); foreach (var subitem in item.ChecklistTaskList) { var checklistItem = new ChecklistTaskModel { Id = subitem.Id, ChecklistItem = subitem.ChecklistItem, Completed = subitem.Completed, FileUri = subitem.FileUri }; checklistTasks.Add(checklistItem); } var checklistModel = new ChecklistModel { Id = item.Id, ChecklistStatus = item.ChecklistStatus, ChecklistTaskList = checklistTasks, ChecklistChannel = item.ChecklistChannel }; viewModel.Checklists.Add(checklistModel); } //Granular Access : End } return(viewModel); } catch (Exception ex) { throw new ResponseException($"RequestId: {requestId} - CheckListProcessService MapToModel oppId: {entity.Id} - failed to map opportunity: {ex}"); } }
public void Insert(ChecklistModel checklist) { DataContext.Insert(TableName, IdColumn, new { Name = checklist.Name, UserId = UserId }); }
public ActionResult AddReceptionProcedure(long Id, string ActionName) { ChecklistDetailViewModel checklistViewDetail = new ChecklistDetailViewModel(); List <ChecklistDetailModel> checklistDetail = new List <ChecklistDetailModel>(); ChecklistModel Checklist = new ChecklistModel(); checklistViewDetail.ActionName = ActionName; if (Id != 0) { checklistDetail = GetChecklistDetailByChecklistId(_checklistDetailService, Id); if (checklistDetail.Count == 0) { var checklist = GetChecklistById(_checklistService, Id); if (checklist != null && checklist.Id != 0) { Checklist.Id = checklist.Id; Checklist.Name = checklist.Name; Checklist.Note = checklist.Note; } } else { Checklist.Id = checklistDetail[0].ChecklistId; Checklist.Name = checklistDetail[0].ChecklistName; Checklist.Note = checklistDetail[0].ChecklistNote; foreach (var item in checklistDetail) { item.Index = item.Id; if (checklistViewDetail.ActionName == Hrm.Common.ActionName.Copy) { item.Id = 0; Checklist.Id = 0; } } } } var responseMasterData = this._masterDataService.GetAllMasterDataByName(MasterGroup.ChecklistDetailType, _languageId); if (responseMasterData != null) { var resultMasterData = JsonConvert.DeserializeObject <HrmResultModel <MasterDataModel> >(responseMasterData); if (!CheckPermission(resultMasterData)) { //return to Access Denied } else { checklistViewDetail.MasterData = JsonConvert.DeserializeObject <List <dynamic> >(JsonConvert.SerializeObject(resultMasterData.Results)); } } var responseMasterDataControlType = this._masterDataService.GetAllMasterDataByName(MasterGroup.ControlType, _languageId); if (responseMasterDataControlType != null) { var ressultMasterDataControlType = JsonConvert.DeserializeObject <HrmResultModel <MasterDataModel> >(responseMasterDataControlType); if (!CheckPermission(ressultMasterDataControlType)) { //return to Access Denied } else { checklistViewDetail.MasterDataControlType = JsonConvert.DeserializeObject <List <dynamic> >(JsonConvert.SerializeObject(ressultMasterDataControlType.Results)); } } checklistViewDetail.Checklist = Checklist; checklistViewDetail.ChecklistDetail = JsonConvert.DeserializeObject <List <dynamic> >(JsonConvert.SerializeObject(checklistDetail)); return(View(checklistViewDetail)); }
//ResizingLayout layout; public CommentPage(Inspection inspection, Question initialQuestion) { this.inspection = inspection; ChecklistModel checklist = inspection.Checklist; this.Title = "Add/Edit Comment"; StackLayout layout = new StackLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center }; Page frontPage = App.Navigation.NavigationStack.First(); double width = frontPage.Width; layout.WidthRequest = width * .95; //Choose comment type Label chooseCommentTypeLabel = new Label { Text = "Choose comment type" }; commentTypePicker = new GenericPicker <CommentType>(); commentTypePicker.AddItem(CommentType.Finding); commentTypePicker.AddItem(CommentType.Observation); commentTypePicker.AddItem(CommentType.Commendable); commentTypePicker.SelectedIndexChanged += SelectCommentType; //Choose question Label chooseQuestionLabel = new Label { Text = "Choose question" }; questionPicker = new GenericPicker <Question>(); foreach (Question question in checklist.GetAllQuestions().Where(q => !q.HasSubItems)) { questionPicker.AddItem(question); } questionPicker.SelectedIndexChanged += SelectQuestion; //Comment description Label commentSubjectLabel = new Label { Text = "Subject" }; subjectTextEditor = new Editor(); subjectTextEditor.HeightRequest = 80; //Enter comment commentIndicatorLabel = new Label { Text = "Comment:" }; commentText = new Editor(); commentText.HeightRequest = 80; //Discussion Label DiscussionLabel = new Label { Text = "Discussion:" }; discussionText = new Editor(); discussionText.HeightRequest = 80; //Recommendation Label RecommendationLabel = new Label { Text = "Recommendation/Action Taken or Required:" }; recommendationText = new Editor(); recommendationText.HeightRequest = 80; //Choose date Label chooseDateLabel = new Label { Text = "Date:" }; DatePicker date = new DatePicker(); date.Date = DateTime.Now; //Save button Button saveButton = new Button { Text = "Save Comment" }; saveButton.Clicked += SaveComment; //Delete button Button deleteButton = new Button { Text = "Delete Comment" }; deleteButton.Clicked += DeleteComment; //TODO: choose inspector //TODO more fields, I guess. //Perform the setup actions. commentTypePicker.SelectedIndex = 0; questionPicker.SelectedIndex = questionPicker.TItems.IndexOf(initialQuestion); layout.Children.Add(chooseCommentTypeLabel); layout.Children.Add(commentTypePicker); layout.Children.Add(chooseQuestionLabel); layout.Children.Add(questionPicker); layout.Children.Add(commentSubjectLabel); layout.Children.Add(subjectTextEditor); layout.Children.Add(commentIndicatorLabel); layout.Children.Add(commentText); layout.Children.Add(DiscussionLabel); layout.Children.Add(discussionText); layout.Children.Add(RecommendationLabel); layout.Children.Add(recommendationText); layout.Children.Add(chooseDateLabel); layout.Children.Add(date); layout.Children.Add(saveButton); layout.Children.Add(deleteButton); ScrollView scroll = new ScrollView(); scroll.Content = layout; this.Content = scroll; }
public EditInspectionPage(Inspection existingInspection = null, ChecklistModel checklist = null) { Padding = new Thickness(0, 5, 0, 0); if (existingInspection == null) { inspection = new Inspection(); inspection.Checklist = checklist; inspection.ChecklistId = checklist.Id; Title = "Create new Inspection"; selectedInspectors = new List <Inspector>(); } else { inspection = existingInspection; selectedInspectors = inspection.inspectors; Title = "Edit Inspection"; } TableView view = new TableView(); TableRoot root = new TableRoot("Edit Inspection"); TableSection section = new TableSection(); StackLayout layout = new StackLayout(); StackLayout nameLayout = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new Label { Text = "Inspection Name:" } } }; Entry nameEntry = new Entry(); nameEntry.WidthRequest = 300; nameEntry.BindingContext = inspection; nameEntry.SetBinding(Entry.TextProperty, "Name"); nameLayout.Children.Add(nameEntry); EntryCell NameCell = new EntryCell { BindingContext = inspection, Label = "Inspection Name:", }; NameCell.SetBinding(EntryCell.TextProperty, "Name"); EntryCell OrganizationCell = new EntryCell { BindingContext = inspection, Label = "Organization:", }; OrganizationCell.SetBinding(EntryCell.TextProperty, "Organization"); StackLayout orgLayout = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new Label { Text = "Organization:" } } }; Entry orgEntry = new Entry(); orgEntry.BindingContext = inspection; orgEntry.SetBinding(Entry.TextProperty, "Organization"); orgEntry.WidthRequest = 300; orgLayout.Children.Add(orgEntry); inspectorPicker = new GenericPicker <Inspector>(); availableInspectors = App.database.LoadAllInspectors(); availableInspectors.Add(Inspector.Null); foreach (Inspector selectedInspector in selectedInspectors) { availableInspectors.RemoveAll(i => i.Id == selectedInspector.Id); } selectedInspectors.Add(Inspector.Null); foreach (Inspector inspector in availableInspectors) { inspectorPicker.AddItem(inspector); } if (inspection.inspectors.Any()) { try { inspectorPicker.SelectedItem = inspection.inspectors.First(); } catch (KeyNotFoundException) { } } ViewCell inspectorCell = new ViewCell { View = inspectorPicker }; ViewCell inspectorsCell = new ViewCell(); StackLayout inspectorsLayout = new StackLayout { Orientation = StackOrientation.Horizontal, Padding = new Thickness(5, 0), }; StackLayout availableLayout = new StackLayout(); Rectangle bounds = App.GetPageBounds(); availableLayout.WidthRequest = (bounds.Width / 2) - 5; availableLayout.HeightRequest = 400; StackLayout selectedLayout = new StackLayout(); selectedLayout.WidthRequest = (bounds.Width / 2) - 5; selectedLayout.HeightRequest = 400; Label availableLabel = new Label { Text = "Available Inspectors" }; Label selectedLabel = new Label { Text = "Selected Inspectors" }; availableLayout.Children.Add(availableLabel); selectedLayout.Children.Add(selectedLabel); inspectorsLayout.Children.Add(availableLayout); inspectorsLayout.Children.Add(selectedLayout); inspectorsCell.View = inspectorsLayout; availableListView = CreateInspectorsListView(availableInspectors); selectedListView = CreateInspectorsListView(selectedInspectors); availableLayout.Children.Add(availableListView); selectedLayout.Children.Add(selectedListView); ViewCell SaveCell = new ViewCell(); //ViewCell CancelCell = new ViewCell(); Button saveButton = new Button(); //Button cancelButton = new Button(); saveButton.Clicked += SaveInspectionClicked; //cancelButton.Clicked += CancelInspectionClicked; saveButton.Text = "Save"; //cancelButton.Text = "Cancel"; SaveCell.View = saveButton; //CancelCell.View = cancelButton; section.Add(NameCell); layout.Children.Add(nameLayout); section.Add(OrganizationCell); layout.Children.Add(orgLayout); section.Add(inspectorCell); layout.Children.Add(inspectorsLayout); section.Add(inspectorsCell); section.Add(SaveCell); layout.Children.Add(saveButton); //section.Add(CancelCell); root.Add(section); view.Root = root; //view.Intent = TableIntent.Form; //view.HasUnevenRows = true; Content = layout; //Content = view; }