protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack && !Page.IsCallback)
        {
            // imgNikePlus.ImageUrl = ResolveUrl("~/DesktopModules/ATI_Fitness/resources/images/iSyncNikePlus.png");
            // set date control to today
            atiRadDatePicker.SelectedDate = DateTime.Now;

            // TODO: consider putting this back in futrue
            atiRadDatePickerHide.Visible = false;
            plHideDate.Visible           = false;
            txtHiddenName.Visible        = false;
            plHiddenName.Visible         = false;
            // END

            atiRadDatePickerHide.SelectedDate = DateTime.Now.AddDays(1);
            if (this.SetControlToWOD != null)
            {
                Aqufit.Helpers.WodItem wi = new Aqufit.Helpers.WodItem()
                {
                    Id = this.SetControlToWOD.Id, Type = (short)this.SetControlToWOD.WODType.Id
                };
                string          json = _serializer.Serialize(wi);
                RadComboBoxItem item = new RadComboBoxItem(this.SetControlToWOD.Name, json);
                item.Selected = true;
                atiRadComboBoxCrossfitWODs.Items.Add(item);
                ScriptManager.RegisterStartupScript(this, Page.GetType(), "InitialWOD", "Aqufit.addLoadEvent(function(){ Aqufit.Page.Controls.atiWodSelector.SetupWOD('" + json + "') });", true);
            }
        }
    }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack && !Page.IsCallback)
        {
            // imgNikePlus.ImageUrl = ResolveUrl("~/DesktopModules/ATI_Fitness/resources/images/iSyncNikePlus.png");
            // set date control to today
            atiRadDatePicker.SelectedDate = DateTime.Now;

            // setup the units control
            atiDistanceUnits.UnitList.Add(Affine.Utils.UnitsUtil.MeasureUnit.UNIT_MILES);
            atiDistanceUnits.UnitList.Add(Affine.Utils.UnitsUtil.MeasureUnit.UNIT_KM);
            atiDistanceUnits.UnitList.Add(Affine.Utils.UnitsUtil.MeasureUnit.UNIT_M);
            atiDistanceUnits.Selected = Affine.Utils.UnitsUtil.MeasureUnit.UNIT_MILES;

            atiMaxWeightUnits.UnitList.Add(Affine.Utils.UnitsUtil.MeasureUnit.UNIT_LBS);
            atiMaxWeightUnits.UnitList.Add(Affine.Utils.UnitsUtil.MeasureUnit.UNIT_KG);
            atiMaxWeightUnits.Selected = Affine.Utils.UnitsUtil.MeasureUnit.UNIT_LBS;

            // Setup the units to the users last used units
            if (this.PortalSettings.UserInfo.UserID != -1)
            {
                aqufitEntities aqufitEntities = new aqufitEntities();
                UserSettings   aqufitSettings = aqufitEntities.UserSettings.FirstOrDefault <UserSettings>(us => us.UserKey == this.PortalSettings.UserInfo.UserID && us.PortalKey == this.PortalSettings.PortalId);
                if (aqufitSettings != null) // TODO: this really should never happen
                {
                    if (aqufitSettings.DistanceUnits != null)
                    {
                        atiDistanceUnits.Selected = (Affine.Utils.UnitsUtil.MeasureUnit)Enum.ToObject(typeof(Affine.Utils.UnitsUtil.MeasureUnit), aqufitSettings.DistanceUnits);
                    }
                    if (aqufitSettings.WeightUnits != null)
                    {
                        atiMaxWeightUnits.Selected = (Affine.Utils.UnitsUtil.MeasureUnit)Enum.ToObject(typeof(Affine.Utils.UnitsUtil.MeasureUnit), aqufitSettings.WeightUnits);
                    }
                }
            }

            if (this.SetControlToWOD != null)
            {
                atiWorkoutTypes.SelectedType = Affine.Utils.WorkoutUtil.WorkoutType.CROSSFIT;
                Aqufit.Helpers.WodItem wi = new Aqufit.Helpers.WodItem()
                {
                    Id = this.SetControlToWOD.Id, Type = (short)this.SetControlToWOD.WODType.Id
                };
                string          json = _serializer.Serialize(wi);
                RadComboBoxItem item = new RadComboBoxItem(this.SetControlToWOD.Name, json);
                item.Selected = true;
                atiRadComboBoxCrossfitWorkouts.Items.Add(item);
                ScriptManager.RegisterStartupScript(this, Page.GetType(), "InitialWOD", "Aqufit.addLoadEvent(function(){ Aqufit.Page." + this.ID + ".configureFormView(" + (int)Affine.Utils.WorkoutUtil.WorkoutType.CROSSFIT + "); Aqufit.Page.Controls.atiWodSelector.SetupWOD('" + json + "') });", true);
            }
            else if (this.SetControlToMapRoute != null)
            {
                Affine.Utils.UnitsUtil.MeasureUnit units = Affine.Utils.UnitsUtil.MeasureUnit.UNIT_MILES;
                double dist = Affine.Utils.UnitsUtil.systemDefaultToUnits(this.SetControlToMapRoute.RouteDistance, units);
                dist = Math.Round(dist, 2);
                Aqufit.Helpers.RouteItem ri = new Aqufit.Helpers.RouteItem()
                {
                    Dist = this.SetControlToMapRoute.RouteDistance, Id = this.SetControlToMapRoute.Id
                };
                string          json = _serializer.Serialize(ri);
                RadComboBoxItem item = new RadComboBoxItem(Affine.Utils.Web.WebUtils.FromWebSafeString(this.SetControlToMapRoute.Name) + " (" + dist + " " + Affine.Utils.UnitsUtil.unitToStringName(units) + ")", json);
                item.Selected = true;
                item.ImageUrl = Affine.Utils.ImageUtil.GetGoogleMapsStaticImage(this.SetControlToMapRoute, 200, 150);
                atiRouteSelector.Items.Add(item);
            }
        }
    }