示例#1
0
        public void getDataFromDb()
        {
            listView1.View = View.Details;

            // Hämta in data.
            DataTable dt;

            if (sqlQuery != null)
            {
                dt = dbOject.executeDbQuery(sqlQuery);
            }
            else
            {
                dt = dataFromOtherView.Copy();
            }

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                // Hämta objektet
                DataRow dr = dt.Rows[i];

                // Visa de olika attibuten i rätt kolumn
                ListViewItem listitem = new ListViewItem(dr["person_id"].ToString().Insert(6, "-"));
                listitem.SubItems.Add(dr["first_name"].ToString());
                listitem.SubItems.Add(dr["last_name"].ToString());
                listitem.SubItems.Add(funcObject.translateStatusCode(int.Parse(dr["status"].ToString())));
                listitem.SubItems.Add(funcObject.getDateByStatus(funcObject.formatDate(dr["planned_birthday"].ToString(), "yyyy-MM-dd"), int.Parse(dr["status"].ToString())));
                listitem.SubItems.Add(funcObject.formatDate(dr["planned_birthday"].ToString(), "yyyy-MM-dd"));

                // Visa Ja eller Nej
                if (dr["interpreter"].ToString() == "1")
                {
                    listitem.SubItems.Add("Ja");
                }
                else
                {
                    listitem.SubItems.Add("Nej");
                }


                // Lägg upp i listan
                listView1.Items.Add(listitem);
            }
        }
示例#2
0
        public void countCallings()
        {
            // Hämta in data.
            var dt = dbOject.executeDbQuery("SELECT * FROM Children");

            manageCallingsData      = dt.Clone();
            manageNotificationsData = dt.Clone();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                // Hämta objektet
                DataRow dr = dt.Rows[i];

                int status = new int();
                if (dr["status"].ToString() != "")
                {
                    status = int.Parse(dr["status"].ToString());
                }

                int countInterval = (funcObject.countDays(funcObject.getDateByStatus(dr["planned_birthday"].ToString(), status), dateNow) * -1);

                Console.WriteLine("DATUM NU: " + dateNow);
                Console.WriteLine("INTERVALL: " + interval);
                Console.WriteLine("countInterval: " + countInterval);

                if (countInterval < 0 && countInterval >= interval)
                {
                    if (status == 0 || status <= 3)
                    {
                        doctor          = doctor + 30;
                        physiotherapist = physiotherapist + 30;

                        // Lägg till
                        manageCallingsData.ImportRow(dr);

                        callings++;
                    }
                    else if (status >= 4 && status <= 5)
                    {
                        doctor          = doctor + 30;
                        physiotherapist = physiotherapist + 30;
                        psychologist    = psychologist + 30;

                        // Lägg till
                        manageCallingsData.ImportRow(dr);

                        callings++;
                    }
                }
                else
                {
                    if (status != 6)
                    {
                        if ((countInterval + interval) <= interval)
                        {
                            notifications = notifications + 1;

                            // Lägg till
                            manageNotificationsData.ImportRow(dr);
                        }
                    }
                }
            }

            // Räkna ut tiden
            time = doctor + physiotherapist + psychologist;

            // Visa
            callingslabel.Text        = callings.ToString();
            timeLabel.Text            = doctor.ToString();
            physiotherapistLabel.Text = physiotherapist.ToString();
            notificationsLabel.Text   = notifications.ToString();
        }