Пример #1
0
        /// <summary>
        /// Gets the users normal range set in personal settings.
        /// </summary>
        /// <returns>Point that contains the low (X) and high (Y) of the users personal settings normal range.</returns>
        private System.Drawing.Point GetPersonalNormalRange()
        {
            using (QueriesTableAdapters.sp_GetUserSettingsTableAdapter ta = new QueriesTableAdapters.sp_GetUserSettingsTableAdapter())
            {
                using (Queries.sp_GetUserSettingsDataTable dt = new Queries.sp_GetUserSettingsDataTable())
                {
                    ta.Fill(dt, LoginRow.user_id);

                    return(new System.Drawing.Point(dt.FirstOrDefault().lownormal, dt.FirstOrDefault().highnormal));
                }
            }
        }
Пример #2
0
        private MorningAfternoonNight GetUserTimeSettings()
        {
            using (QueriesTableAdapters.sp_GetUserSettingsTableAdapter ta = new QueriesTableAdapters.sp_GetUserSettingsTableAdapter())
            {
                using (Queries.sp_GetUserSettingsDataTable dt = new Queries.sp_GetUserSettingsDataTable())
                {
                    ta.Fill(dt, LoginRow.user_id);

                    if (dt.Rows.Count > 0)
                    {
                        Queries.sp_GetUserSettingsRow row = (Queries.sp_GetUserSettingsRow)dt[0];
                        return(new MorningAfternoonNight(row.start_morning, row.start_afternoon, row.start_night));
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //redirect if not logged in
            if (Session["LoggedInUser"] == null)
            {
                Response.Redirect("~/Account/Login.aspx");
            }
            else
            {
                LoginRow = (GTService.Common.sp_GetLoginRow)Session["LoggedInUser"];

                if (Session["LoggedInUserId"] != null)
                {
                    Session["LoggedInUserId"] = LoginRow.user_id;
                }
                else
                {
                    Session.Add("LoggedInUserId", LoginRow.user_id);
                }
            }

            Response.Cache.SetCacheability(HttpCacheability.NoCache);

            if (!IsPostBack)
            {
                SetResources();

                Populate_YearDropdown(ddBirthdate_Year);
                Populate_MonthDropdown(ddBirthdate_Month);

                //get current settings
                using (QueriesTableAdapters.sp_GetUserSettingsTableAdapter ta = new QueriesTableAdapters.sp_GetUserSettingsTableAdapter())
                {
                    using (Queries.sp_GetUserSettingsDataTable dt = new Queries.sp_GetUserSettingsDataTable())
                    {
                        ta.Fill(dt, LoginRow.user_id);

                        PopulateTimeDropdown(ddMorningStart, Convert.ToInt32(dt[0]["start_morning"]));
                        PopulateTimeDropdown(ddAfternoonStart, Convert.ToInt32(dt[0]["start_afternoon"]));
                        PopulateTimeDropdown(ddNightStart, Convert.ToInt32(dt[0]["start_night"]));

                        this.txtFirstName.Text  = dt[0]["firstname"].ToString();
                        this.txtMiddleName.Text = dt[0]["middlename"].ToString();
                        this.txtLastName.Text   = dt[0]["lastname"].ToString();
                        this.txtAddress1.Text   = dt[0]["address1"].ToString();
                        this.txtAddress2.Text   = dt[0]["address2"].ToString();
                        this.txtCity.Text       = dt[0]["city"].ToString();

                        this.txtZipcode.Text           = dt[0]["zipcode"].ToString();
                        this.lblLastSyncValue.Text     = dt[0]["last_sync"].ToString();
                        this.lblLastWebLoginValue.Text = dt[0]["last_weblogin"].ToString();
                        this.txtEmail.Text             = dt[0]["email"].ToString();
                        this.txtOtherState.Text        = dt[0]["other_state"].ToString();

                        ddState.DataBind();
                        ddUserType.DataBind();
                        ddCountry.DataBind();
                        ddIncome.DataBind();
                        ddSex.DataBind();
                        ddRace.DataBind();
                        ddTimezone.DataBind();
                        ddDiabetesType.DataBind();

                        SelectInDropDown(ddState, dt[0]["state_id"].ToString().Trim());
                        SelectInDropDown(ddUserType, dt[0]["usertype_id"].ToString().Trim());
                        SelectInDropDown(ddCountry, dt[0]["country_id"].ToString().Trim());
                        SelectInDropDown(ddIncome, dt[0]["income_id"].ToString().Trim());
                        SelectInDropDown(ddSex, dt[0]["sex_id"].ToString().Trim());
                        SelectInDropDown(ddRace, dt[0]["race_id"].ToString().Trim());
                        SelectInDropDown(ddTimezone, dt[0]["timezone_id"].ToString().Trim());
                        SelectInDropDown(ddDiabetesType, dt[0]["diabetestypes_id"].ToString().Trim());

                        DateTime dtBirthDate = Convert.ToDateTime(dt[0]["birthdate"].ToString().Trim());
                        SelectInDropDown(ddBirthdate_Month, dtBirthDate.Month.ToString().Trim());
                        this.txtBirthdate_Day.Text = dtBirthDate.Day.ToString();
                        SelectInDropDown(ddBirthdate_Year, dtBirthDate.Year.ToString().Trim());
                    }
                }

                //shows the correct state/province field based on country settings (must be after population of fields)
                ShowStateSelection();

                //get user image
                using (QueriesTableAdapters.sp_GetUserImageTableAdapter ta = new QueriesTableAdapters.sp_GetUserImageTableAdapter())
                {
                    using (Queries.sp_GetUserImageDataTable dt = new Queries.sp_GetUserImageDataTable())
                    {
                        ta.Fill(dt, LoginRow.user_id);

                        if (dt.Rows.Count > 0)
                        {
                            PendingAvatar = dt[0].image;
                        }
                    }
                }
            }
        }
Пример #4
0
        private MorningAfternoonNight GetUserTimeSettings()
        {
            using (QueriesTableAdapters.sp_GetUserSettingsTableAdapter ta = new QueriesTableAdapters.sp_GetUserSettingsTableAdapter())
            {
                using (Queries.sp_GetUserSettingsDataTable dt = new Queries.sp_GetUserSettingsDataTable())
                {
                    ta.Fill(dt, LoginRow.user_id);

                    if (dt.Rows.Count > 0)
                    {
                        Queries.sp_GetUserSettingsRow row = (Queries.sp_GetUserSettingsRow)dt[0];
                        return new MorningAfternoonNight(row.start_morning, row.start_afternoon, row.start_night);
                    }
                    else
                    {
                        return null;
                    }
                }
            }
        }
Пример #5
0
        /// <summary>
        /// Gets the users normal range set in personal settings.
        /// </summary>
        /// <returns>Point that contains the low (X) and high (Y) of the users personal settings normal range.</returns>
        private System.Drawing.Point GetPersonalNormalRange()
        {
            using (QueriesTableAdapters.sp_GetUserSettingsTableAdapter ta = new QueriesTableAdapters.sp_GetUserSettingsTableAdapter())
            {
                using (Queries.sp_GetUserSettingsDataTable dt = new Queries.sp_GetUserSettingsDataTable())
                {
                    ta.Fill(dt, LoginRow.user_id);

                    return new System.Drawing.Point(dt.FirstOrDefault().lownormal, dt.FirstOrDefault().highnormal);
                }
            }
        }
Пример #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //redirect if not logged in
            if (Session["LoggedInUser"] == null)
            {
                Response.Redirect("~/Account/Login.aspx");
            }
            else
            {
                LoginRow = (GTService.Common.sp_GetLoginRow)Session["LoggedInUser"];

                if (Session["LoggedInUserId"] != null)
                    Session["LoggedInUserId"] = LoginRow.user_id;
                else
                    Session.Add("LoggedInUserId", LoginRow.user_id);
            }

            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            
            if (!IsPostBack)
            {
                SetResources();

                Populate_YearDropdown(ddBirthdate_Year);
                Populate_MonthDropdown(ddBirthdate_Month);

                //get current settings
                using (QueriesTableAdapters.sp_GetUserSettingsTableAdapter ta = new QueriesTableAdapters.sp_GetUserSettingsTableAdapter())
                {
                    using (Queries.sp_GetUserSettingsDataTable dt = new Queries.sp_GetUserSettingsDataTable())
                    {
                        ta.Fill(dt, LoginRow.user_id);

                        PopulateTimeDropdown(ddMorningStart, Convert.ToInt32(dt[0]["start_morning"]));
                        PopulateTimeDropdown(ddAfternoonStart, Convert.ToInt32(dt[0]["start_afternoon"]));
                        PopulateTimeDropdown(ddNightStart, Convert.ToInt32(dt[0]["start_night"]));

                        this.txtFirstName.Text = dt[0]["firstname"].ToString();
                        this.txtMiddleName.Text = dt[0]["middlename"].ToString();
                        this.txtLastName.Text = dt[0]["lastname"].ToString();
                        this.txtAddress1.Text = dt[0]["address1"].ToString();
                        this.txtAddress2.Text = dt[0]["address2"].ToString();
                        this.txtCity.Text = dt[0]["city"].ToString();

                        this.txtZipcode.Text = dt[0]["zipcode"].ToString();
                        this.lblLastSyncValue.Text = dt[0]["last_sync"].ToString();
                        this.lblLastWebLoginValue.Text = dt[0]["last_weblogin"].ToString();
                        this.txtEmail.Text = dt[0]["email"].ToString();
                        this.txtOtherState.Text = dt[0]["other_state"].ToString();

                        ddState.DataBind();
                        ddUserType.DataBind();
                        ddCountry.DataBind();
                        ddIncome.DataBind();
                        ddSex.DataBind();
                        ddRace.DataBind();
                        ddTimezone.DataBind();
                        ddDiabetesType.DataBind();

                        SelectInDropDown(ddState, dt[0]["state_id"].ToString().Trim());
                        SelectInDropDown(ddUserType, dt[0]["usertype_id"].ToString().Trim());
                        SelectInDropDown(ddCountry, dt[0]["country_id"].ToString().Trim());
                        SelectInDropDown(ddIncome, dt[0]["income_id"].ToString().Trim());
                        SelectInDropDown(ddSex, dt[0]["sex_id"].ToString().Trim());
                        SelectInDropDown(ddRace, dt[0]["race_id"].ToString().Trim());
                        SelectInDropDown(ddTimezone, dt[0]["timezone_id"].ToString().Trim());
                        SelectInDropDown(ddDiabetesType, dt[0]["diabetestypes_id"].ToString().Trim());

                        DateTime dtBirthDate = Convert.ToDateTime(dt[0]["birthdate"].ToString().Trim());
                        SelectInDropDown(ddBirthdate_Month, dtBirthDate.Month.ToString().Trim());
                        this.txtBirthdate_Day.Text = dtBirthDate.Day.ToString();
                        SelectInDropDown(ddBirthdate_Year, dtBirthDate.Year.ToString().Trim());
                    }
                }

                //shows the correct state/province field based on country settings (must be after population of fields)
                ShowStateSelection();

                //get user image
                using (QueriesTableAdapters.sp_GetUserImageTableAdapter ta = new QueriesTableAdapters.sp_GetUserImageTableAdapter())
                {
                    using (Queries.sp_GetUserImageDataTable dt = new Queries.sp_GetUserImageDataTable())
                    {
                        ta.Fill(dt, LoginRow.user_id);

                        if (dt.Rows.Count > 0)
                        {
                            PendingAvatar = dt[0].image;
                        }
                    }
                }
            }
        }