// Constructor public GoalStepsPage(Occurance occurance, SubOccurance subTask, string color) { InitializeComponent(); SetColorTheme(); SetTitleGridOnIOS(); SetGoalOccurance(occurance, subTask); SetGoalTaskLabel(); SetTaskInstructions(); }
//Used to update a goal/routine public static async Task <string> updateOccurance(SubOccurance currOccurance, bool inprogress, bool iscomplete, string url) { CheckTimeZone(); currOccurance.updateIsInProgress(inprogress); currOccurance.updateIsComplete(iscomplete); Debug.WriteLine("InProgress = " + currOccurance.IsInProgress + "\n IsComplete = " + currOccurance.IsComplete); UpdateOccurance updateOccur = new UpdateOccurance(); updateOccur.id = currOccurance.Id; updateOccur.datetime_completed = currOccurance.Id; updateOccur.datetime_started = currOccurance.Id; updateOccur.is_in_progress = currOccurance.IsInProgress; updateOccur.is_complete = currOccurance.IsComplete; if (currOccurance.IsComplete == false && currOccurance.IsInProgress == false) { updateOccur.datetime_completed = ""; updateOccur.datetime_started = ""; } if (currOccurance.IsComplete == false && currOccurance.IsInProgress == true) { updateOccur.datetime_completed = ""; updateOccur.datetime_started = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt"); } if (currOccurance.IsComplete == true && currOccurance.IsInProgress == false) { updateOccur.datetime_completed = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt"); updateOccur.datetime_started = currOccurance.DateTimeStarted.ToString("yyyy-MM-dd hh:mm:ss tt"); } string toSend = updateOccur.updateOccurance(); Debug.WriteLine("LINE 122 " + toSend); var content = new StringContent(toSend); var res = await client.PostAsync(url, content); if (res.IsSuccessStatusCode) { Debug.WriteLine("Wrote to the datebase"); return("Success"); } else { Debug.WriteLine("Some error"); Debug.WriteLine(toSend); Debug.WriteLine(res.ToString()); return("Failure"); } //return "Failure"; }
public static List <SubOccurance> GetSubOccurances(List <SubOccuranceDto> actions_tasks, ref Occurance parent) { List <SubOccurance> subTasks = null; try { if (actions_tasks != null && actions_tasks.Count != 0) { subTasks = new List <SubOccurance>(); foreach (SubOccuranceDto dto in actions_tasks) { SubOccurance toAdd = new SubOccurance(); toAdd.Id = dto.at_unique_id; toAdd.Title = dto.at_title; toAdd.GoalRoutineID = dto.goal_routine_id; toAdd.AtSequence = dto.at_sequence; toAdd.IsAvailable = DataParser.ToBool(dto.is_available); toAdd.IsComplete = DataParser.ToBool(dto.is_complete); toAdd.IsInProgress = DataParser.ToBool(dto.is_in_progress); toAdd.IsSublistAvailable = DataParser.ToBool(dto.is_sublist_available); toAdd.IsMustDo = DataParser.ToBool(dto.is_must_do); toAdd.PicUrl = dto.photo; toAdd.IsTimed = DataParser.ToBool(dto.is_timed); toAdd.DateTimeCompleted = DataParser.ToDateTime(dto.datetime_completed); toAdd.DateTimeStarted = DataParser.ToDateTime(dto.datetime_started); toAdd.ExpectedCompletionTime = DataParser.ToTimeSpan(dto.expected_completion_time); toAdd.AvailableStartTime = DataParser.ToDateTime(dto.available_start_time); toAdd.AvailableEndTime = DataParser.ToDateTime(dto.available_end_time); toAdd.instructions = GetInstructions(dto.instructions_steps); subTasks.Add(toAdd); parent.NumSubOccurances = parent.NumSubOccurances + 1; if (toAdd.IsComplete == true) { parent.SubOccurancesCompleted++; } } } } catch (Exception GetSubOccuranceIssue) { Debug.WriteLine("THERE WAS A PROBLEM IN THE 'GetSubOccurance' FUNCTION: " + GetSubOccuranceIssue.Message); } return(subTasks); }
public RoutineStepsPage(SubOccurance subTask, Occurance routine) { InitializeComponent(); SetLocationDate(); setting = false; height = mainStackLayoutRow.Height; frameColor.BackgroundColor = MainPage.account.headerColor; title.Text = "Steps"; if (Device.RuntimePlatform == Device.iOS) { titleGrid.Margin = new Thickness(0, 10, 0, 0); } circleHW = (float)(deviceWidth * 0.13); circleRadius = (float)(circleHW * 0.5); rowHeight = (float)Math.Min(80, 0.02 * deviceHeight); //stepsScroll.HeightRequest = (deviceHeight / 2) - 500; parent = subTask; currRoutine = routine; subTitle.Text = subTask.Title; instruction_steps = subTask.instructions; items = new ObservableCollection <Instruction>(); processedSteps = new List <int>(); NavigationPage.SetHasNavigationBar(this, false); CreateList(); }
void SetGoalOccurance(Occurance occurance, SubOccurance subTask) { goalOccurance = occurance; task = subTask; }