示例#1
0
                public static DateTime DateEnd(string content)
                {
                    DateTime dt = new DateTime();

                    try
                    {
                        SubjectStatus lhpState     = TrangThai(content);
                        DateTime      ngayThucHien = NgayThucHien(content);
                        string[]      tietHoc      = TietHocArray(content);

                        if (tietHoc != null)
                        {
                            if (tietHoc.Length == 2)
                            {
                                dt = ngayThucHien.Add(TietThanhGio[tietHoc[1]]);
                            }
                        }
                    }
                    catch
                    {
                        dt = new DateTime();
                    }

                    return(dt);
                }
示例#2
0
 public void SetSubjectStatus(SubjectStatus status)
 {
     if (subjectStatus == status)
     {
         // this subject is already infected, return.
         return;
     }
     else
     {
         subjectStatus = status;
         onSubjectStatusChanged.Invoke(id, subjectStatus);
         if (subjectStatus == SubjectStatus.Infected)
         {
             infected.SetActive(false);
             neutralSymptoms.SetActive(true);
             healthy.SetActive(false);
             neutral.SetActive(false);
         }
         else
         {
             infected.SetActive(false);
             neutralSymptoms.SetActive(false);
             healthy.SetActive(false);
             neutral.SetActive(true);
         }
     }
 }
示例#3
0
                public static string TietHocRaw(string content)
                {
                    string result = null;

                    try
                    {
                        SubjectStatus lhpState = TrangThai(content);
                        string        beginStr = null;
                        string        endStr   = null;
                        if (lhpState == SubjectStatus.NghiHoc)
                        {
                            beginStr = "(Tiết:";
                            endStr   = ")";
                        }
                        else if (lhpState == SubjectStatus.HocBu)
                        {
                            beginStr = ",Tiết: ";
                            endStr   = ", ";
                        }
                        int beginIndex = content.IndexOf(beginStr);
                        int endIndex   = content.IndexOf(endStr, beginIndex);

                        result = content.Substring(
                            beginIndex + beginStr.Length,
                            endIndex - beginIndex - beginStr.Length
                            );
                    }
                    catch
                    {
                        result = null;
                    }

                    return(result);
                }
示例#4
0
                public static string Room(string content)
                {
                    string result = null;

                    try
                    {
                        SubjectStatus lhpState = TrangThai(content);
                        string        beginStr = null;

                        if (lhpState == SubjectStatus.HocBu)
                        {
                            beginStr = ", phòng: ";
                        }
                        int beginIndex = content.IndexOf(beginStr);

                        result = content.Substring(
                            beginIndex + beginStr.Length,
                            content.Length - beginIndex - beginStr.Length
                            );
                    }
                    catch
                    {
                        result = null;
                    }

                    return(result);
                }
示例#5
0
        public static string MailSubjectStatus(SubjectStatus status)
        {
            string result = null;

            switch (status)
            {
            case SubjectStatus.AccountConfirmationMail:
                result = "Account Confirmation By Email";
                break;

            case SubjectStatus.ChangePasswordRequest:
                result = "Change Your Password By Email";
                break;

            case SubjectStatus.DeleteAccountRequest:
                result = "Do You Want To Delete Your Account Permanently ?";
                break;

            case SubjectStatus.InformAboutDeletedAccount:
                result = "Your Account Is Deleted By Administration";
                break;

            default:
                break;
            }
            return(result);
        }
示例#6
0
 public void OnSubjectStatusChanged(int id, SubjectStatus subjectStatus)
 {
     if (subjectStatus == SubjectStatus.Infected)
     {
         infectedSubjects[id] = allSubjects[id];
     }
 }
示例#7
0
 public void IncreaseSubjectsInIsolationCount(int id, SubjectStatus subjectStatus)
 {
     subjectsIsolationScore++;
     if (gameState == GameState.Playing)
     {
         onPopulationChange.Invoke(GetGameStats());
     }
 }
示例#8
0
 public void IncreaseSubjectInfectedCount(int id, SubjectStatus subjectStatus)
 {
     if (subjectStatus == SubjectStatus.Infected)
     {
         subjectsInfectedScore++;
         if (gameState == GameState.Playing)
         {
             onPopulationChange.Invoke(GetGameStats());
             EvaluateTooMuchSpread();
         }
     }
 }
示例#9
0
 public void DecreasePopulationCount(int id, SubjectStatus subjectStatus)
 {
     if (subjectStatus == SubjectStatus.Infected)
     {
         populationScore--;
         dangerImage.TriggerDangerImage();
         if (gameState == GameState.Playing)
         {
             onPopulationChange.Invoke(GetGameStats());
         }
     }
 }
示例#10
0
 // Update is called once per frame
 void Update()
 {
     if (currentFindState == CurrentFindState.ShowingFind)
     {
         timer -= Time.deltaTime;
         if (timer < 0f)
         {
             currentFindObject.SetActive(false);
             currentFindState = CurrentFindState.Invisible;
             currentFindType  = SubjectStatus.Null;
         }
     }
     else if (currentFindState == CurrentFindState.Invisible)
     {
         timer = hideTime;
     }
 }
示例#11
0
 public void OnRevealInfo(RevealInfo revealInfo)
 {
     if (currentFindType != revealInfo.subjectStatus)
     {
         currentFindObject.SetActive(true);
         if (revealInfo.subjectStatus == SubjectStatus.Infected)
         {
             ShowInfectedAvatar();
             currentFindType = SubjectStatus.Infected;
             timer           = hideTime;
         }
         else if (revealInfo.subjectStatus == SubjectStatus.Healthy)
         {
             ShowSusceptibleAvatar();
             currentFindType = SubjectStatus.Healthy;
             timer           = hideTime;
         }
         currentFindState = CurrentFindState.ShowingFind;
     }
 }
示例#12
0
                public static DateTime NgayThucHien(string content)
                {
                    DateTime dt = new DateTime();

                    try
                    {
                        SubjectStatus lhpState   = TrangThai(content);
                        string        beginStr   = " ngày: ";
                        string        endStr     = ",";
                        int           beginIndex = content.IndexOf(beginStr);
                        int           endIndex   = content.IndexOf(endStr);

                        if (lhpState == SubjectStatus.NghiHoc)
                        {
                            dt = Convert.ToDateTime(
                                content.Substring(
                                    beginIndex + beginStr.Length,
                                    content.Length - beginIndex - beginStr.Length
                                    )
                                );
                        }
                        else if (lhpState == SubjectStatus.HocBu)
                        {
                            dt = Convert.ToDateTime(
                                content.Substring(
                                    beginIndex + beginStr.Length,
                                    endIndex - beginIndex - beginStr.Length
                                    )
                                );
                        }
                    }
                    catch
                    {
                        dt = new DateTime();
                    }

                    return(dt);
                }
示例#13
0
        public ActionResult AddSubject(string subject_name, string dateStr, SubjectStatus status)
        {
            var result = new ResultData <Subject>();

            try
            {
                SubjectServices.ValidateName(subject_name);
                SubjectServices.ValidateDate(dateStr, out DateTime date);

                if (db.Materia.Select(q => q.Name).Contains(subject_name))
                {
                    result.Error = true;
                    result.Message.Add($"O nome {subject_name} já esta cadastrado");
                    result.Status = HttpStatusCode.BadRequest;
                    return(BadRequest(result));
                }

                Subject subject = new Subject(subject_name, date, status);
                db.Materia.Add(subject);
                db.SaveChanges();
                result.Error  = false;
                result.Status = HttpStatusCode.OK;
                result.Data   = db.Materia.ToList();
                return(Ok(result));
            }
            catch (Exception e)
            {
                result.Error = true;
                result.Message.Add(e.Message);
                return(BadRequest(result));
            }
            finally
            {
                db.Dispose();
            }
        }
示例#14
0
 public Subject(string name, DateTime registry, SubjectStatus status)
 {
     Name     = name;
     Registry = registry;
     Status   = status;
 }
 public Subject(SubjectStatusActions subjectStatusActions)
 {
     _status = SubjectStatus.Suscribe();
     _subjectStatusActions = subjectStatusActions;
 }
 public void GivePracticalWork() =>
 _status = _status.DeliveredPracticalWorks();
 public void GiveFinalExam(SubjectNote note) =>
 _status = _note.Add(note, () => note.CheckNote(_status.ApproveFinalExam, _status.DisapproveFinalExam));