public List <DiseaseInfo> GetFakeClosedDiseases()
        {
            var list  = new List <DiseaseInfo> ();
            var info1 = new DiseaseInfo
            {
                Id                   = 1,
                DiseaseName          = "Cholera",
                DoctorOpenFirstName  = "Ivan",
                DoctorOpenLastName   = "Petrov",
                StartDateTime        = new DateTime(2015, 10, 12, 12, 30, 00),
                Description          = "tttttttttttttttttttttttt",
                Treatment            = "ddddddddddddddddddddddddd",
                DoctorCloseFirstName = "Mykola",
                DoctorCloseLastName  = "Buga",
                EndDateTime          = new DateTime(2018, 11, 12, 10, 30, 00)
            };
            var info2 = new DiseaseInfo
            {
                Id                   = 2,
                DiseaseName          = "Gryp",
                DoctorOpenFirstName  = "Ivanna",
                DoctorOpenLastName   = "Shpack",
                StartDateTime        = new DateTime(2010, 8, 12, 19, 30, 00),
                Description          = "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii",
                Treatment            = "yyyyyyyyyyyyyyyyyyyyy",
                DoctorCloseFirstName = "Mykola",
                DoctorCloseLastName  = "Tuz",
                EndDateTime          = new DateTime(2017, 2, 21, 10, 00, 00)
            };

            list.Add(info1);
            list.Add(info2);
            return(list);
        }
Beispiel #2
0
        public static List <DiseaseInfo> GetClosedDiseaseInfo(string bdResult)
        {
            int index  = 0;
            var values = bdResult.Split('*');
            var result = new List <DiseaseInfo>();

            if (bdResult == "")
            {
                result.Add(new DiseaseInfo());
            }
            else
            {
                for (int i = 0; i < values.Length; i += 9)
                {
                    var Diseases = new DiseaseInfo()
                    {
                        Id                   = index++,
                        DiseaseName          = values.GetValue(i).ToString(),
                        DoctorOpenFirstName  = values.GetValue(1 + i).ToString(),
                        DoctorOpenLastName   = values.GetValue(2 + i).ToString(),
                        StartDateTime        = Convert.ToDateTime(values.GetValue(3 + i)),
                        Description          = values.GetValue(4 + i).ToString(),
                        Treatment            = values.GetValue(5 + i).ToString(),
                        DoctorCloseFirstName = values.GetValue(6 + i).ToString(),
                        DoctorCloseLastName  = values.GetValue(7 + i).ToString(),
                        EndDateTime          = Convert.ToDateTime(values.GetValue(8 + i))
                    };
                    result.Add(Diseases);
                }
            }
            return(result);
        }
Beispiel #3
0
        public static DiseaseInfo GetPercentOfDisease(PrimaryElement pe, float percent)
        {
            DiseaseInfo result = default(DiseaseInfo);

            result.idx   = pe.DiseaseIdx;
            result.count = (int)((float)pe.DiseaseCount * percent);
            return(result);
        }
        public DiseaseInfo GetFakeDiseaseInfo()
        {
            var diseaseInfo = new DiseaseInfo
            {
                DoctorOpenFirstName = "Oleg",
                DoctorOpenLastName  = "Smachnyy",
                StartDateTime       = new DateTime(2015, 10, 12, 12, 30, 0),
                Description         = "patient Smachnyy is ill",
                Treatment           = "patient Smachnyy is very ill"
            };

            return(diseaseInfo);
        }
Beispiel #5
0
        public static DiseaseInfo GetDiagnoseInfo(string bdResult)
        {
            var values = bdResult.Split('*');
            var result = new DiseaseInfo();

            if (bdResult == "")
            {
                result = new DiseaseInfo();
            }
            else
            {
                result = new DiseaseInfo()
                {
                    DoctorOpenFirstName = (values.GetValue(0)).ToString(),
                    DoctorOpenLastName  = values.GetValue(1).ToString(),
                    StartDateTime       = Convert.ToDateTime(values.GetValue(2)),
                    Description         = values.GetValue(3).ToString(),
                    Treatment           = values.GetValue(4).ToString()
                };
            }
            return(result);
        }
Beispiel #6
0
        public static DiseaseInfo CalculateFinalDiseaseInfo(byte src1_idx, int src1_count, byte src2_idx, int src2_count)
        {
            DiseaseInfo result = default(DiseaseInfo);

            if (src1_idx == src2_idx)
            {
                result.idx   = src1_idx;
                result.count = src1_count + src2_count;
            }
            else if (src1_idx == 255)
            {
                result.idx   = src2_idx;
                result.count = src2_count;
            }
            else if (src2_idx == 255)
            {
                result.idx   = src1_idx;
                result.count = src1_count;
            }
            else
            {
                Disease disease  = Db.Get().Diseases[src1_idx];
                Disease disease2 = Db.Get().Diseases[src2_idx];
                float   num      = disease.strength * (float)src1_count;
                float   num2     = disease2.strength * (float)src2_count;
                if (num > num2)
                {
                    int num3 = (int)((float)src2_count - num / num2 * (float)src1_count);
                    if (num3 < 0)
                    {
                        result.idx   = src1_idx;
                        result.count = -num3;
                    }
                    else
                    {
                        result.idx   = src2_idx;
                        result.count = num3;
                    }
                }
                else
                {
                    int num4 = (int)((float)src1_count - num2 / num * (float)src2_count);
                    if (num4 < 0)
                    {
                        result.idx   = src2_idx;
                        result.count = -num4;
                    }
                    else
                    {
                        result.idx   = src1_idx;
                        result.count = num4;
                    }
                }
            }
            if (result.count <= 0)
            {
                result.count = 0;
                result.idx   = byte.MaxValue;
            }
            return(result);
        }
Beispiel #7
0
 public static DiseaseInfo CalculateFinalDiseaseInfo(DiseaseInfo a, DiseaseInfo b)
 {
     return(CalculateFinalDiseaseInfo(a.idx, a.count, b.idx, b.count));
 }