public void SetAssignment(DataAssignment assignment) { mAssignment = assignment; Clear(); mTitle.text = mAssignment.Name; mCategory.text = mAssignment.Category.Name; for (int i = 0; i < mAssignment.Forms.Length; i++) { SubmissionInput formType = (SubmissionInput)mAssignment.Forms[i].ID; switch (formType) { case SubmissionInput.Photo: mPhoto.SetActive(true); break; case SubmissionInput.Write: mWrite.SetActive(true); break; case SubmissionInput.Check: mCheck.SetActive(true); break; case SubmissionInput.All: mPhoto.SetActive(true); mWrite.SetActive(true); mCheck.SetActive(true); break; } } }
private static string CreateFormatedTimeString(DataAssignment data, bool clampLength) { string content = "<b>"; // End date content += "Datum: <color=#01C0D1FF>"; content += GetDateString(data.EndAt.Value); content += "</color> "; // Remaining timespan content += GetRemainingDaysString(data); content += "</b>\n"; // Active timespan if (data.EndAt.HasValue && data.StartAt.HasValue) { TimeSpan timeSpan = data.EndAt.Value - data.StartAt.Value; if (timeSpan.TotalMinutes > 10 && timeSpan.TotalHours < 20) { // Show time span content += "<b>Klockan: <color=#01C0D1FF>" + data.StartAt.Value.ToString("HH:mm") + "</color> till <color=#01C0D1FF>" + data.EndAt.Value.ToString("HH:mm") + "</color></b>\n"; } } content += GetDescriptionString(data, clampLength); return(content); }
private static string GetRemainingDaysString(DataAssignment data) { string result = string.Empty; // Remaining timespan int daysToEnd = DateHelper.DaysToEnd(data.EndAt.Value); string color = data.StatusObject.Color; string days = Mathf.Abs(daysToEnd).ToString(); if (daysToEnd < -1) { result = TextManager.Get("Time_Late"); } else if (daysToEnd < 0) { result = TextManager.Get("Time_Yesterday"); } else if (daysToEnd < 1) { result = TextManager.Get("Time_Today"); } else if (daysToEnd < 2) { result = TextManager.Get("Time_Tomorrow"); } else { result = TextManager.Get("Time_Future"); } result = result.Replace("<COLOR>", color).Replace("<DAYS>", days); return(result); }
public static void Open(DataAssignment assignment, bool fromPlant = false) { mCurrentAssignment = assignment; mCameFromPlant = fromPlant; UIManager.Open(UILocation.InspectAssignment); }
public static string Create(DataAssignment data, bool clampLength) { if (data.IsSubmitted) { return(CreateFormatedSubmitString(data, clampLength)); } else { return(CreateFormatedTimeString(data, clampLength)); } }
private static string CreateFormatedSubmitString(DataAssignment data, bool clampLength) { string content = string.Empty; if (data.IsWaiting) { content += "<b><color=#F18700FF>Inlämnad - inväntar bekräftelse</color></b>\n"; } else { content += "<b>Avklarat <color=#52AA50FF>" + GetDateString(data.FinishedAt.Value) + "</color></b>\n"; } content += GetDescriptionString(data, clampLength); return(content); }
public override void SetData(DataBaseObject data) { mData = data as DataAssignment; bool isActivity = mData.EndAt.HasValue && mData.StartAt.HasValue; mTopIcon.sprite = isActivity ? mActivitySprite : mAssignmentSprite; mTitleText.text = mData.Name; mCategoryText.text = mData.Category.Name; mContentText.text = AssignmentContentFormat.Create(mData, true); mLayout.PerformLayout(); UpdateBox(); }
private void HandleGoalClick(DataGoal goal) { if (goal is DataAssignment) { DataAssignment assignment = goal as DataAssignment; if (assignment.IsSubmitted) { ScreenInspectAssignmentDone.Open(assignment, true); } else { ScreenInspectAssignment.Open(assignment, true); } } else { ScreenMonthlyCheck.Open(goal); } }
private static string GetDescriptionString(DataAssignment data, bool clampLength) { string result = string.Empty; if (!string.IsNullOrEmpty(data.Description)) { bool isLong = clampLength && data.Description.Length > 95; if (isLong) { result += data.Description.Substring(0, 95); result += "<color=#01C0D1FF><b> ...mer</b></color>"; } else { result += data.Description; } } return(result); }