Ejemplo n.º 1
0
        public static async Task MergeAssesment(CloudTable table, Assesment ass)
        {
            TableOperation isertorMerge = TableOperation.InsertOrMerge(ass);
            TableResult    res          = await table.ExecuteAsync(isertorMerge);

            Assesment asse = res.Result as Assesment;
        }
Ejemplo n.º 2
0
        public IActionResult MyNeighborhood()
        {
            ViewData["Construction"] = false;

            Assesment user = getUser();

            ViewData["User"] = user;

            return(View());
        }
Ejemplo n.º 3
0
        public IActionResult Queues()
        {
            ViewData["Construction"] = false;
            ViewData["Message"]      = "Your application description page.";
            Assesment user = getUser();

            ViewData["User"] = user;

            List <SelectListItem> Countries = new List <SelectListItem>();

            foreach (string country in CountryArrays.Names)
            {
                SelectListItem li = new SelectListItem();
                li.Text  = country;
                li.Value = country;
                Countries.Add(li);
            }
            ViewData["Countries"] = Countries;
            return(View());
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Results()
        {
            if (HttpContext.Request.Cookies.ContainsKey("UserID"))
            {
                CloudStorageAccount storageAccount;
                storageAccount = CloudStorageAccount.Parse(connectionString);
                CloudTableClient tableClient;
                tableClient = storageAccount.CreateCloudTableClient();
                CloudTable table  = tableClient.GetTableReference(getTableAssessments());
                string     userId = HttpContext.Request.Cookies["UserID"];

                TableQuery <Assesment> rangeQuery = new TableQuery <Assesment>()
                                                    .Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, userId));
                TableContinuationToken continuationToken = null;
                var entities = table.ExecuteQuerySegmentedAsync(rangeQuery, continuationToken).Result;

                Dictionary <DateTime, Assesment> listaAssesmentes = new Dictionary <DateTime, Assesment>();
                DateTime fecha = new DateTime();
                foreach (Assesment ass in entities)
                {
                    if (DateTime.Parse(ass.RowKey) > fecha)
                    {
                        fecha = DateTime.Parse(ass.RowKey);
                    }

                    listaAssesmentes.Add(DateTime.Parse(ass.RowKey), ass);
                }

                ViewData["UserID"] = HttpContext.Request.Cookies["UserID"];

                if (fecha != new DateTime())
                {
                    ViewData["Results"] = listaAssesmentes[fecha];
                }
                else
                {
                    ViewData["Results"] = new Assesment(0, "");
                }
            }
            return(View());
        }
Ejemplo n.º 5
0
        public async Task <JsonResult> SaveAssesment(string UserID,
                                                     string Mobile,
                                                     string Evaluation,
                                                     string LatBrowser,
                                                     string LongBrowser,
                                                     string LatPost,
                                                     string LongPost,
                                                     string Postal,
                                                     string Country,
                                                     string PreDiseases,
                                                     string Age,
                                                     string Fever,
                                                     string Cough,
                                                     string DryCough,
                                                     string Breath,
                                                     string BreathTimes,
                                                     string BreathResults,
                                                     string Condition,
                                                     string Administrative_area_level_5,
                                                     string Administrative_area_level_4,
                                                     string Administrative_area_level_3,
                                                     string Administrative_area_level_2,
                                                     string Administrative_area_level_1

                                                     )
        {
            CloudStorageAccount storageAccount;

            storageAccount = CloudStorageAccount.Parse(connectionString);
            CloudTableClient tableClient;

            tableClient = storageAccount.CreateCloudTableClient();
            int calculousuario = 0;

            if (string.IsNullOrEmpty(UserID))
            {
                CloudTable     table          = tableClient.GetTableReference(getTableUserIds());
                TableOperation tableOperation = TableOperation.Retrieve <UserIDs>("1", "1");
                TableResult    bh             = await table.ExecuteAsync(tableOperation);

                UserIDs usersids = bh.Result as UserIDs;
                usersids.IDACTUAL += 1;
                calculousuario     = usersids.IDACTUAL;

                MergeUserIDS(table, usersids).Wait();
            }
            else
            {
                calculousuario = int.Parse(UserID);
            }

            bool   MobileAss      = Mobile.Equals("true") ? true : false;
            int    EvaluationAss  = int.Parse(Evaluation);
            double LatBrowserAss  = double.Parse(LatBrowser, CultureInfo.InvariantCulture);
            double LongBrowserAss = double.Parse(LongBrowser, CultureInfo.InvariantCulture);
            double LatPostAss     = double.Parse(LatPost, CultureInfo.InvariantCulture);
            double LongPostAss    = double.Parse(LongPost, CultureInfo.InvariantCulture);
            string PostalAss      = Postal;
            string CountryAss     = Country;
            string PreDiseasesAss = PreDiseases;
            int    AgeAss         = Age.Equals("Age9") ? 9: Age.Equals("Age8")? 8 : Age.Equals("Age7") ? 7 : Age.Equals("Age6") ? 6 : Age.Equals("Age5") ? 5 :
                                    Age.Equals("Age4") ? 4 : Age.Equals("Age3") ? 3 : Age.Equals("Age2") ? 2 : 1;
            bool   FeverAss         = Fever.Equals("FeverYes") ? true : false;
            bool   CoughAss         = Cough.Equals("CoughYes") ? true : false;
            bool   DryCoughAss      = DryCough.Equals("DryCoughYes") ? true : false;
            int    BreathAss        = int.Parse(Breath);
            int    BreathTimesAss   = int.Parse(BreathTimes);
            int    BreathResultsAss = int.Parse(BreathResults);
            string ConditionAss     = Condition;

            string fecha     = DateTime.Now.Date.ToString("yyy-MM-dd");
            int    resultado = int.Parse(Evaluation);

            if (Administrative_area_level_5 == null)
            {
                Administrative_area_level_5 = "";
            }
            if (Administrative_area_level_4 == null)
            {
                Administrative_area_level_4 = "";
            }
            if (Administrative_area_level_3 == null)
            {
                Administrative_area_level_3 = "";
            }
            if (Administrative_area_level_2 == null)
            {
                Administrative_area_level_2 = "";
            }
            if (Administrative_area_level_1 == null)
            {
                Administrative_area_level_1 = "";
            }


            Assesment asses = new Assesment(calculousuario, fecha)
            {
                Mobile        = MobileAss,
                Evaluation    = EvaluationAss,
                LatBrowser    = LatBrowserAss,
                LongBrowser   = LongBrowserAss,
                LatPost       = LatPostAss,
                LongPost      = LongPostAss,
                Postal        = Postal,
                Country       = Country,
                PreDiseases   = PreDiseases,
                Age           = AgeAss,
                Fever         = FeverAss,
                Cough         = CoughAss,
                DryCough      = DryCoughAss,
                Breath        = BreathAss,
                BreathTimes   = BreathTimesAss,
                BreathResults = BreathResultsAss,
                Condition     = Condition,
                Administrative_area_level_5 = Administrative_area_level_5,
                Administrative_area_level_4 = Administrative_area_level_4,
                Administrative_area_level_3 = Administrative_area_level_3,
                Administrative_area_level_2 = Administrative_area_level_2,
                Administrative_area_level_1 = Administrative_area_level_1
            };

            string root = "";

            try
            {
                CloudTable table = tableClient.GetTableReference(getTableAssessments());
                MergeAssesment(table, asses).Wait();

                root = calculousuario.ToString();
            }

            catch (Exception e)
            {
                root = "";
            }

            return(Json(root));
        }