Exemplo n.º 1
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        grid = new Table {
            ID = "grid4", ClientIDMode = ClientIDMode.Static
        };
        pager = new Panel {
            ID = "pager4", ClientIDMode = ClientIDMode.Static
        };

        IEnumerable <PreValue> platforms = UmbracoCustom.DataTypeValue(int.Parse(UmbracoCustom.GetParameterValue(UmbracoType.Platform)));

        platformSelected = new HiddenField {
            ID = "platformSelected", Value = platforms.First().Id.ToString(), ClientIDMode = ClientIDMode.Static
        };

        Panel pnlForm = new Panel {
            ID = "pnlForm4", CssClass = "form-horizontal", ClientIDMode = ClientIDMode.Static
        };

        pnlForm.Controls.Add(grid);
        pnlForm.Controls.Add(pager);
        pnlForm.Controls.Add(platformSelected);

        Controls.Add(pnlForm);
    }
Exemplo n.º 2
0
    private void LoadData()
    {
        int                documentId   = int.Parse(HttpContext.Current.Request.QueryString["id"]);
        Document           Workout      = new Document(documentId);
        int                objectType   = UmbracoCustom.DataTypeValue(Convert.ToInt32(UmbracoCustom.GetParameterValue(UmbracoType.ObjectType))).Single(o => o.Value.ToLower() == "workout").Id;
        List <PushMessage> pushMessages = new List <PushMessage>();
        string             cn           = UmbracoCustom.GetParameterValue(UmbracoType.Connection);
        SqlDataReader      reader       = SqlHelper.ExecuteReader(cn, CommandType.StoredProcedure, "SelectPushMessage",
                                                                  new SqlParameter {
            ParameterName = "@ObjectId", Value = Workout.Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
        },
                                                                  new SqlParameter {
            ParameterName = "@ObjectType", Value = objectType, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
        }
                                                                  );

        while (reader.Read())
        {
            pushMessages.Add(new PushMessage
            {
                Id             = Convert.ToInt32(reader.GetValue(0)),
                Token          = reader.GetValue(1).ToString(),
                NotificationId = Convert.ToInt32(reader.GetValue(2)),
                UserId         = Convert.ToInt32(reader.GetValue(3)),
                UserType       = Convert.ToInt32(reader.GetValue(4)),
                ObjectId       = Convert.ToInt32(reader.GetValue(5)),
                ObjectType     = Convert.ToInt32(reader.GetValue(6)),
                Message        = reader.GetValue(7).ToString(),
                SendDate       = Convert.ToDateTime(reader.GetValue(8))
            });
        }
        GridView.DataSource = pushMessages;
        GridView.DataBind();
    }
Exemplo n.º 3
0
    public JsonResult SetPost(Post post)
    {
        SetPostUser(post);
        string       cn = UmbracoCustom.GetParameterValue(UmbracoType.Connection);
        SqlParameter Id = new SqlParameter("@Id", SqlDbType.Int);

        Id.Direction = ParameterDirection.Output;
        SqlHelper.ExecuteNonQuery(cn, CommandType.StoredProcedure, "InsertPost", Id,
                                  new SqlParameter {
            ParameterName = "@Message", Value = post.Message, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.NVarChar, Size = 500
        },
                                  new SqlParameter {
            ParameterName = "@TopicId", Value = post.TopicId, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
        },
                                  new SqlParameter {
            ParameterName = "@UserId", Value = post.UserId, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
        },
                                  new SqlParameter {
            ParameterName = "@UserType", Value = post.UserType, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
        }
                                  );
        post = SelectPostById(Convert.ToInt32(Id.Value));

        return(Json(post));
    }
Exemplo n.º 4
0
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        int id = Convert.ToInt32(UmbracoCustom.GetParameterValue(UmbracoType.Category));

        UmbracoCustom.DataTypeValue(id);
    }
Exemplo n.º 5
0
    public JsonResult GetMarkers()
    {
        ArrayList    list   = new ArrayList();
        Document     site   = new Document(int.Parse(UmbracoCustom.GetParameterValue(UmbracoType.Paramount)));
        DocumentType office = DocumentType.GetByAlias("Office");

        list.Add(new Marker
        {
            name   = "Corporate Office",
            latLng = new ArrayList
            {
                decimal.Parse(site.getProperty("latitude").Value.ToString()),
                decimal.Parse(site.getProperty("longitude").Value.ToString())
            }
        });
        Document regionalOffice = new Document(int.Parse(UmbracoCustom.GetParameterValue(UmbracoType.RegionalOffice)));

        foreach (Document region in regionalOffice.Children)
        {
            foreach (Document marker in region.Children.Where(r => r.ContentType.Id == office.Id))
            {
                list.Add(new Marker
                {
                    name   = marker.Text,
                    latLng = new ArrayList
                    {
                        decimal.Parse(marker.getProperty("latitude").Value.ToString()),
                        decimal.Parse(marker.getProperty("longitude").Value.ToString())
                    }
                });
            }
        }
        return(Json(list, JsonRequestBehavior.AllowGet));
    }
Exemplo n.º 6
0
    private void HtmlButtonOnServerClick(object sender, EventArgs eventArgs)
    {
        int      documentId = int.Parse(HttpContext.Current.Request.QueryString["id"]);
        Document Gymnast    = new Document(documentId);

        int userType = UmbracoCustom.DataTypeValue(Convert.ToInt32(UmbracoCustom.GetParameterValue(UmbracoType.UserType))).Single(u => u.Value.ToLower() == "trainer").Id;

        string cn = UmbracoCustom.GetParameterValue(UmbracoType.Connection);

        SqlHelper.ExecuteNonQuery(cn, CommandType.StoredProcedure, "InsertChat",
                                  new SqlParameter {
            ParameterName = "@Id", Value = new int(), Direction = ParameterDirection.Output, SqlDbType = SqlDbType.Int
        },
                                  new SqlParameter {
            ParameterName = "@GymnastId", Value = Gymnast.Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
        },
                                  new SqlParameter {
            ParameterName = "@Message", Value = HtmlTextArea.Value, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.VarChar, Size = 500
        },
                                  new SqlParameter {
            ParameterName = "@UserId", Value = User.GetCurrent().Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
        },
                                  new SqlParameter {
            ParameterName = "@UserType", Value = userType, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
        }
                                  );
        HtmlTextArea.Value = string.Empty;
        LoadData();
        NotificationMessage();
    }
Exemplo n.º 7
0
    public PartialViewResult GetInfo(string state)
    {
        Info info = new Info
        {
            Offices = new List <Office>(),
            Basins  = new List <string>(),
            State   = state
        };
        DocumentType basin  = DocumentType.GetByAlias("Basin");
        DocumentType office = DocumentType.GetByAlias("Office");
        Document     site   = new Document(int.Parse(UmbracoCustom.GetParameterValue(UmbracoType.Paramount)));

        if (site.getProperty("state").Value.ToString() == state)
        {
            info.Offices.Add(new Office(site, "Corporate Office"));
        }
        Document regionalOffice = new Document(int.Parse(UmbracoCustom.GetParameterValue(UmbracoType.RegionalOffice)));
        Document region         = regionalOffice.Children.SingleOrDefault(r => r.Text == state);

        if (region != null)
        {
            foreach (Document marker in region.Children)
            {
                if (marker.ContentType.Id == basin.Id)
                {
                    info.Basins.Add(marker.Text);
                }
                else if (marker.ContentType.Id == office.Id)
                {
                    info.Offices.Add(new Office(marker));
                }
            }
        }
        return(PartialView("_RegionInfo", info));
    }
Exemplo n.º 8
0
    private List <TemplateWorkout> SelectTemplateByTrainerId(string cmd)
    {
        List <TemplateWorkout> templates = new List <TemplateWorkout>();
        string cn = UmbracoCustom.GetParameterValue(UmbracoType.Connection);

        SqlDataReader reader = SqlHelper.ExecuteReader(cn, CommandType.Text, cmd);

        while (reader.Read())
        {
            templates.Add(new TemplateWorkout
            {
                Id = Convert.ToInt32(reader.GetValue(0)),
                //TemplateName = reader.GetValue(1).ToString(),
                //Exercise = new Exercise
                //{
                //    TrainerId = Convert.ToInt32(reader.GetValue(2)),
                //    Id = Convert.ToInt32(reader.GetValue(3)),
                //    ExerciseName = reader.GetValue(4).ToString(),
                //    Description = reader.GetValue(5).ToString(),
                //    TypeId = Convert.ToInt32(reader.GetValue(6)),
                //    Type = UmbracoCustom.PropertyValue(UmbracoType.Type, reader.GetValue(6)),
                //    UnitId = Convert.ToInt32(reader.GetValue(7)),
                //    Unit = UmbracoCustom.PropertyValue(UmbracoType.Unit, reader.GetValue(7)),
                //    CategoryId = Convert.ToInt32(reader.GetValue(8)),
                //    Category = UmbracoCustom.PropertyValue(UmbracoType.Category, reader.GetValue(8))
                //}
            });
        }
        return(templates);
    }
Exemplo n.º 9
0
    private Measurement SelectMeasurementByGymnastId(int id)
    {
        Measurement   measurement = new Measurement();
        string        cn          = UmbracoCustom.GetParameterValue(UmbracoType.Connection);
        SqlDataReader reader      = SqlHelper.ExecuteReader(cn, CommandType.StoredProcedure, "SelectMeasurementByGymnastId", new SqlParameter {
            ParameterName = "@GymnastId", Value = id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
        });

        while (reader.Read())
        {
            measurement = new Measurement
            {
                Id          = Convert.ToInt32(reader.GetValue(0)),
                GymnastId   = Convert.ToInt32(reader.GetValue(1)),
                Weight      = Convert.ToDecimal(reader.GetValue(2)),
                Neck        = Convert.ToDecimal(reader.GetValue(3)),
                Shoulders   = Convert.ToDecimal(reader.GetValue(4)),
                RightArm    = Convert.ToDecimal(reader.GetValue(5)),
                LeftArm     = Convert.ToDecimal(reader.GetValue(6)),
                Chest       = Convert.ToDecimal(reader.GetValue(7)),
                BellyButton = Convert.ToDecimal(reader.GetValue(8)),
                Hips        = Convert.ToDecimal(reader.GetValue(9)),
                RightThigh  = Convert.ToDecimal(reader.GetValue(10)),
                LeftThigh   = Convert.ToDecimal(reader.GetValue(11)),
                RightCalf   = Convert.ToDecimal(reader.GetValue(12)),
                LeftCalf    = Convert.ToDecimal(reader.GetValue(13)),
                Arm         = Convert.ToDecimal(reader.GetValue(14)),
                Waist       = Convert.ToDecimal(reader.GetValue(15)),
                Thigh       = Convert.ToDecimal(reader.GetValue(16)),
                Back        = Convert.ToDecimal(reader.GetValue(17)),
                CreatedDate = Convert.ToDateTime(reader.GetValue(18))
            };
        }
        return(measurement);
    }
Exemplo n.º 10
0
    private List <Exercise> SelectExerciseByCategory(int id)
    {
        User            user      = umbraco.BusinessLogic.User.GetCurrent();
        List <Exercise> exercises = new List <Exercise>();
        string          cn        = UmbracoCustom.GetParameterValue(UmbracoType.Connection);
        string          cmd       = "SelectExerciseByCategory";
        SqlDataReader   reader    = SqlHelper.ExecuteReader(cn, CommandType.StoredProcedure, cmd, new SqlParameter {
            ParameterName = "@CategoryId", Value = id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
        },
                                                            new SqlParameter {
            ParameterName = "@TrainerId", Value = user.Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
        }
                                                            );

        while (reader.Read())
        {
            exercises.Add(new Exercise
            {
                Id           = Convert.ToInt32(reader.GetValue(0)),
                ExerciseName = reader.GetValue(1).ToString(),
                TrainerId    = reader.IsDBNull(2) ? (int?)null : Convert.ToInt32(reader.GetValue(3)),
                CategoryId   = Convert.ToInt32(reader.GetValue(3)),
                Category     = UmbracoCustom.PropertyValue(UmbracoType.Category, reader.GetValue(3)),
                IsActive     = Convert.ToBoolean(reader.GetValue(4))
            });
        }
        return(exercises);
    }
Exemplo n.º 11
0
    private List <Routine> SelectRoutineByWorkout(string cmd)
    {
        List <Routine> routines = new List <Routine>();
        string         cn       = UmbracoCustom.GetParameterValue(UmbracoType.Connection);
        SqlDataReader  reader   = SqlHelper.ExecuteReader(cn, CommandType.Text, cmd);

        while (reader.Read())
        {
            routines.Add(new Routine
            {
                Exercise = new Exercise
                {
                    Id           = Convert.ToInt32(reader.GetValue(0)),
                    ExerciseName = reader.GetValue(1).ToString(),
                    Description  = reader.GetValue(2).ToString(),
                    TrainerId    = reader.IsDBNull(3) ? (int?)null : Convert.ToInt32(reader.GetValue(3)),
                    TypeId       = Convert.ToInt32(reader.GetValue(4)),
                    Type         = UmbracoCustom.PropertyValue(UmbracoType.Type, reader.GetValue(4)),
                    UnitId       = Convert.ToInt32(reader.GetValue(5)),
                    Unit         = UmbracoCustom.PropertyValue(UmbracoType.Unit, reader.GetValue(5)),
                    CategoryId   = Convert.ToInt32(reader.GetValue(6)),
                    Category     = UmbracoCustom.PropertyValue(UmbracoType.Category, reader.GetValue(6)),
                    IsActive     = Convert.ToBoolean(reader.GetValue(7)),
                },
                Id = Convert.ToInt32(reader.GetValue(8)),
                //Value = Convert.ToDecimal(reader.GetValue(9).ToString()),
                StateId   = reader.IsDBNull(10) ? (int?)null : Convert.ToInt32(reader.GetValue(10)),
                State     = UmbracoCustom.PropertyValue(UmbracoType.State, reader.GetValue(10)),
                SortOrder = Convert.ToByte(reader.GetValue(11))
            });
        }
        return(routines);
    }
Exemplo n.º 12
0
    public List <Post> SelectPost(int id)
    {
        List <Post>   posts  = new List <Post>();
        string        cn     = UmbracoCustom.GetParameterValue(UmbracoType.Connection);
        SqlDataReader reader = SqlHelper.ExecuteReader(cn, CommandType.StoredProcedure, "SelectPost", new SqlParameter {
            ParameterName = "@TopicId", Value = id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
        });

        while (reader.Read())
        {
            Post post = new Post
            {
                Id          = Convert.ToInt32(reader.GetValue(0)),
                Message     = reader.GetValue(1).ToString(),
                TopicId     = Convert.ToInt32(reader.GetValue(2)),
                UserId      = Convert.ToInt32(reader.GetValue(3)),
                UserType    = Convert.ToInt32(reader.GetValue(4)),
                CreatedDate = Convert.ToDateTime(reader.GetValue(5).ToString()),
                UpdatedDate = reader.IsDBNull(6) ? (DateTime?)null : Convert.ToDateTime(reader.GetValue(6).ToString())
            };
            GetPostUser(post);
            posts.Add(post);
        }
        return(posts);
    }
Exemplo n.º 13
0
    private List <PushNotification> SelectNotificationByMember(int id)
    {
        string cn = UmbracoCustom.GetParameterValue(UmbracoType.Connection);
        List <PushNotification> notifications = new List <PushNotification>();
        SqlDataReader           reader        = SqlHelper.ExecuteReader(cn, CommandType.StoredProcedure, "SelectNotificationByMember",
                                                                        new SqlParameter
        {
            ParameterName = "@MemberId",
            Value         = id,
            Direction     = ParameterDirection.Input,
            SqlDbType     = SqlDbType.Int
        });

        while (reader.Read())
        {
            notifications.Add(new PushNotification
            {
                Id         = int.Parse(reader.GetValue(0).ToString()),
                MemberId   = int.Parse(reader.GetValue(1).ToString()),
                Token      = reader.GetValue(2).ToString(),
                DeviceId   = int.Parse(reader.GetValue(3).ToString()),
                IsActive   = bool.Parse(reader.GetValue(4).ToString()),
                Device     = reader.GetValue(5).ToString(),
                PlatformId = int.Parse(reader.GetValue(6).ToString()),
                Platform   = UmbracoCustom.PropertyValue(UmbracoType.Platform, reader.GetValue(6))
            });
        }
        return(notifications);
    }
Exemplo n.º 14
0
    public JsonResult DeletePost(int id)
    {
        string cn = UmbracoCustom.GetParameterValue(UmbracoType.Connection);

        SqlHelper.ExecuteNonQuery(cn, CommandType.StoredProcedure, "DeletePost", new SqlParameter {
            ParameterName = "@Id", Value = id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
        });
        return(Json("Success"));
    }
Exemplo n.º 15
0
    public JsonResult SetRoutine(Routine routine, string oper, string Id, string Category, string ExerciseName, string Value, string sortOrder)
    {
        string cn = UmbracoCustom.GetParameterValue(UmbracoType.Connection);

        switch (oper)
        {
        case "add":
            NameValueCollection nameValueCollection = HttpUtility.ParseQueryString(Request.UrlReferrer.Query);
            int      documentId     = int.Parse(nameValueCollection["id"]);
            Document document       = new Document(documentId);
            Document parentDocument = new Document(document.ParentId);

            SqlHelper.ExecuteNonQuery(cn, CommandType.StoredProcedure, "InsertRoutine",
                                      new SqlParameter {
                ParameterName = "@Id", Value = routine.Id, Direction = ParameterDirection.Output, SqlDbType = SqlDbType.Int
            },
                                      new SqlParameter {
                ParameterName = "@DocumentId", Value = parentDocument.Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
            },
                                      new SqlParameter {
                ParameterName = "@ExerciseId", Value = int.Parse(ExerciseName), Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
            },
                                      new SqlParameter {
                ParameterName = "@MemberId", Value = Convert.ToInt32(parentDocument.getProperty("member").Value), Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
            },
                                      new SqlParameter {
                ParameterName = "@TrainerId", Value = Convert.ToInt32(parentDocument.getProperty("trainer").Value), Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
            },
                                      new SqlParameter {
                ParameterName = "@WorkoutId", Value = document.Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
            },
                                      new SqlParameter {
                ParameterName = "@Value", Value = Value, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Decimal
            }
                                      );
            break;

        case "edit":
            SqlHelper.ExecuteNonQuery(cn, CommandType.StoredProcedure, "UpdateRoutine",
                                      new SqlParameter {
                ParameterName = "@Id", Value = Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
            },
                                      new SqlParameter {
                ParameterName = "@ExerciseId", Value = int.Parse(ExerciseName), Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
            },
                                      new SqlParameter {
                ParameterName = "@Value", Value = Value, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Decimal
            }
                                      );
            break;

        case "del":
            break;
        }
        return(Json("Success Save"));
    }
Exemplo n.º 16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object"/> class.
 /// </summary>
 public Office(Document document, string name)
 {
     Name    = name;
     Address = UmbracoCustom.GetTextAreaFormat(document.getProperty("address").Value.ToString());
     City    = document.getProperty("city").Value.ToString();
     Fax     = document.getProperty("fax").Value.ToString();
     Phone   = document.getProperty("phone").Value.ToString();
     State   = document.getProperty("state").Value.ToString();
     ZipCode = document.getProperty("zipCode").Value.ToString();
 }
Exemplo n.º 17
0
    public JsonResult SetExerciseTrainer(Exercise exercise, string oper)
    {
        string cn = UmbracoCustom.GetParameterValue(UmbracoType.Connection);

        switch (oper)
        {
        case "add":
            User user = umbraco.BusinessLogic.User.GetCurrent();
            exercise.TrainerId = user.Id;
            SqlHelper.ExecuteNonQuery(cn, CommandType.StoredProcedure, "InsertExercise",
                                      new SqlParameter {
                ParameterName = "@Id", Value = exercise.Id, Direction = ParameterDirection.Output, SqlDbType = SqlDbType.Int
            },
                                      new SqlParameter {
                ParameterName = "@Name", Value = exercise.ExerciseName, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.VarChar, Size = 50
            },
                                      //new SqlParameter { ParameterName = "@Description", Value = exercise.Description, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.VarChar },
                                      new SqlParameter {
                ParameterName = "@TrainerId", Value = (object)exercise.TrainerId ?? DBNull.Value, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
            },
                                      //new SqlParameter { ParameterName = "@TypeId", Value = int.Parse(exercise.Type), Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
                                      //new SqlParameter { ParameterName = "@UnitId", Value = int.Parse(exercise.Unit), Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
                                      new SqlParameter {
                ParameterName = "@CategoryId", Value = int.Parse(exercise.Category), Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
            }
                                      );
            break;

        case "edit":
            SqlHelper.ExecuteNonQuery(cn, CommandType.StoredProcedure, "UpdateExercise",
                                      new SqlParameter {
                ParameterName = "@Id", Value = exercise.Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
            },
                                      new SqlParameter {
                ParameterName = "@Name", Value = exercise.ExerciseName, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.VarChar, Size = 50
            },
                                      //new SqlParameter { ParameterName = "@Description", Value = exercise.Description, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.VarChar },
                                      //new SqlParameter { ParameterName = "@TypeId", Value = int.Parse(exercise.Type), Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
                                      //new SqlParameter { ParameterName = "@UnitId", Value = int.Parse(exercise.Unit), Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int },
                                      new SqlParameter {
                ParameterName = "@CategoryId", Value = int.Parse(exercise.Category), Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
            },
                                      new SqlParameter {
                ParameterName = "@IsActive", Value = exercise.IsActive, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Bit
            }
                                      );
            break;

        case "del":
            break;
        }
        return(Json("Success Save"));
    }
Exemplo n.º 18
0
    private void LoadData()
    {
        string   id        = (Category.SelectedValue != string.Empty ? Category.SelectedValue : "23");
        Document document  = new Document(Convert.ToInt32(UmbracoCustom.GetParameterValue(UmbracoType.GymnastNode)));
        Property property  = document.getProperty("exercise");
        var      exercises = UmbracoCustom.GetDataTypeGrid(property).Where(g => g.category == id);

        Exercise.Items.Clear();
        foreach (var exercise in exercises)
        {
            Exercise.Items.Add(new ListItem(exercise.exercise, exercise.id));
        }
    }
Exemplo n.º 19
0
    public JsonResult GetRegions()
    {
        ArrayList list           = new ArrayList();
        Document  regionalOffice = new Document(int.Parse(UmbracoCustom.GetParameterValue(UmbracoType.RegionalOffice)));

        foreach (Document region in regionalOffice.Children)
        {
            list.Add(region.getProperty("code").Value.ToString());
        }

        //regionalOffice.Children.Select(r => listRegions.Add(r.getProperty("code").Value.ToString()));
        return(Json(list, JsonRequestBehavior.AllowGet));
    }
Exemplo n.º 20
0
    private void ButtonOnClick(object sender, EventArgs eventArgs)
    {
        int      documentId = int.Parse(HttpContext.Current.Request.QueryString["id"]);
        Document Workout    = new Document(documentId);
        Document Gymnast    = new Document(Workout.ParentId);
        int      trainerId  = Convert.ToInt32(Gymnast.getProperty("trainer").Value);
        int      memberId   = Convert.ToInt32(Gymnast.getProperty("member").Value);
        Member   member     = new Member(memberId);
        //Label.Text = string.Format("WorkoutId: {0} / TrainerId: {1} ", documentId, Gymnast.getProperty("trainer").Value);

        SmtpClient  client  = new SmtpClient();
        MailMessage message = new MailMessage();

        message.IsBodyHtml = true;
        message.From       = new MailAddress("*****@*****.**");
        message.To.Add(member.Email);
        message.Subject = "MetaFitness";
        message.Body    = "A new workout is available on your account.";
        client.Send(message);

        int userType   = UmbracoCustom.DataTypeValue(Convert.ToInt32(UmbracoCustom.GetParameterValue(UmbracoType.UserType))).Single(u => u.Value.ToLower() == "trainer").Id;
        int objectType = UmbracoCustom.DataTypeValue(Convert.ToInt32(UmbracoCustom.GetParameterValue(UmbracoType.ObjectType))).Single(o => o.Value.ToLower() == "workout").Id;

        string cn = UmbracoCustom.GetParameterValue(UmbracoType.Connection);

        SqlHelper.ExecuteNonQuery(cn, CommandType.StoredProcedure, "InsertEmailMessage",
                                  new SqlParameter {
            ParameterName = "@Id", Value = new int(), Direction = ParameterDirection.Output, SqlDbType = SqlDbType.Int
        },
                                  new SqlParameter {
            ParameterName = "@UserId", Value = trainerId, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
        },
                                  new SqlParameter {
            ParameterName = "@UserType", Value = userType, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
        },
                                  new SqlParameter {
            ParameterName = "@ObjectId", Value = Workout.Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
        },
                                  new SqlParameter {
            ParameterName = "@ObjectType", Value = objectType, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
        },
                                  new SqlParameter {
            ParameterName = "@Email", Value = member.Email, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.VarChar
        },
                                  new SqlParameter {
            ParameterName = "@Message", Value = "A new workout is available on your account. Check your MetaFitness App now.", Direction = ParameterDirection.Input, SqlDbType = SqlDbType.VarChar, Size = 500
        }
                                  );

        LoadData();
    }
Exemplo n.º 21
0
    public string GetPrevalue(int id)
    {
        StringBuilder result = new StringBuilder();

        result.Append("<select>");
        IEnumerable <PreValue> values = UmbracoCustom.DataTypeValue(id);

        foreach (PreValue preValue in values)
        {
            result.Append(string.Format("<option value='{0}'>{1}</option>", preValue.Id, preValue.Value));
        }
        result.Append("</select>");
        return(result.ToString());
    }
Exemplo n.º 22
0
    public JsonResult SetNotification(PushNotification notification, string oper)
    {
        string cn = UmbracoCustom.GetParameterValue(UmbracoType.Connection);

        switch (oper)
        {
        case "add":
            NameValueCollection nameValueCollection = HttpUtility.ParseQueryString(Request.UrlReferrer.Query);
            int    memberId = int.Parse(nameValueCollection["id"]);
            Member member   = new Member(memberId);
            SqlHelper.ExecuteNonQuery(cn, CommandType.StoredProcedure, "InsertNotification",
                                      new SqlParameter {
                ParameterName = "@Id", Value = notification.Id, Direction = ParameterDirection.Output, SqlDbType = SqlDbType.Int
            },
                                      new SqlParameter {
                ParameterName = "@MemberId", Value = member.Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
            },
                                      new SqlParameter {
                ParameterName = "@Token", Value = notification.Token, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.VarChar, Size = 50
            },
                                      new SqlParameter {
                ParameterName = "@DeviceId", Value = int.Parse(notification.Device), Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
            }
                                      );
            break;

        case "edit":
            SqlHelper.ExecuteNonQuery(cn, CommandType.StoredProcedure, "UpdateNotification",
                                      new SqlParameter {
                ParameterName = "@Id", Value = notification.Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
            },
                                      new SqlParameter {
                ParameterName = "@Token", Value = notification.Token, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.VarChar, Size = 50
            },
                                      new SqlParameter {
                ParameterName = "@DeviceId", Value = int.Parse(notification.Device), Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
            },
                                      new SqlParameter {
                ParameterName = "@IsActive", Value = notification.IsActive, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Bit
            }
                                      );
            break;

        case "del":
            break;
        }
        return(Json("Success Save"));
    }
Exemplo n.º 23
0
    /// <summary>
    /// Initializes a new instance of the <see cref="T:System.Web.UI.WebControls.Panel"/> class.
    /// </summary>
    public ExerciseControl()
    {
        Category = new DropDownList {
            ID = "category", ClientIDMode = ClientIDMode.Static, AutoPostBack = true, DataTextField = "Value", DataValueField = "Id", EnableViewState = false, ViewStateMode = ViewStateMode.Disabled
        };
        int id = Convert.ToInt32(UmbracoCustom.GetParameterValue(UmbracoType.Category));

        Category.DataSource = UmbracoCustom.DataTypeValue(id);
        Category.DataBind();
        Category.SelectedIndexChanged += new EventHandler(Category_SelectedIndexChanged);
        Exercise = new DropDownList {
            ID = "exercise", ClientIDMode = ClientIDMode.Static, AutoPostBack = false, DataTextField = "exercise", DataValueField = "id", EnableViewState = false, ViewStateMode = ViewStateMode.Disabled
        };
        Exercise.TextChanged          += new EventHandler(Exercise_TextChanged);
        Exercise.SelectedIndexChanged += new EventHandler(Exercise_SelectedIndexChanged);
    }
Exemplo n.º 24
0
    private void SetPostUser(Post post)
    {
        User   user   = umbraco.BusinessLogic.User.GetCurrent();
        Member member = Member.GetCurrentMember();

        if (user != null)
        {
            post.UserId   = user.Id;
            post.UserType = UmbracoCustom.DataTypeValue(Convert.ToInt32(UmbracoCustom.GetParameterValue(UmbracoType.UserType))).Single(u => u.Value.ToLower() == "trainer").Id;
        }
        else
        {
            post.UserId   = member.Id;
            post.UserType = UmbracoCustom.DataTypeValue(Convert.ToInt32(UmbracoCustom.GetParameterValue(UmbracoType.UserType))).Single(u => u.Value.ToLower() == "client").Id;
        }
    }
Exemplo n.º 25
0
    public JsonResult InsertTemplateWorkout(string name)
    {
        NameValueCollection nameValueCollection = HttpUtility.ParseQueryString(Request.UrlReferrer.Query);
        int    id = int.Parse(nameValueCollection["id"]);
        string cn = UmbracoCustom.GetParameterValue(UmbracoType.Connection);

        SqlHelper.ExecuteNonQuery(cn, CommandType.StoredProcedure, "InsertTemplateWorkout",
                                  new SqlParameter {
            ParameterName = "@ObjectId", Value = id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
        },
                                  new SqlParameter {
            ParameterName = "@Name", Value = name, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.NVarChar, Size = 50
        }
                                  );
        return(Json("Success"));
    }
Exemplo n.º 26
0
    private List <string> SelectTemplate()
    {
        List <string> templates = new List <string>();
        string        cn        = UmbracoCustom.GetParameterValue(UmbracoType.Connection);
        User          user      = umbraco.BusinessLogic.User.GetCurrent();
        SqlDataReader reader    = SqlHelper.ExecuteReader(cn, CommandType.StoredProcedure, "SelectTemplateByTrainerId", new SqlParameter {
            ParameterName = "@TrainerId", Value = user.Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
        });

        while (reader.Read())
        {
            templates.Add(reader.GetValue(0).ToString());
        }

        return(templates);
    }
Exemplo n.º 27
0
    private List <string> SelectImagesMeasurement(int id, string date)
    {
        //http://localhost/Photo/1159/02252013/fruits2.jpg
        //D:\Photo\1159\02252013\fruits10_thumb.jpg
        List <string> result   = new List <string>();
        string        datePath = Path.Combine(UmbracoCustom.GetParameterValue(UmbracoType.Photo), id.ToString(), date);

        if (Directory.Exists(datePath))
        {
            string[] images = Directory.GetFiles(datePath);
            foreach (string image in images)
            {
                int position = image.IndexOf("Photo");
                result.Add("http://localhost/" + image.Substring(position).Replace(@"\", "/"));
            }
        }
        return(result);
    }
Exemplo n.º 28
0
    public JsonResult UpdateOrder(IEnumerable <int> routines)
    {
        string cn = UmbracoCustom.GetParameterValue(UmbracoType.Connection);

        for (int i = 0; i < routines.Count(); i++)
        {
            SqlHelper.ExecuteNonQuery(cn, CommandType.StoredProcedure, "UpdateRoutineOrder",
                                      new SqlParameter {
                ParameterName = "@Id", Value = routines.ToList()[i], Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
            },
                                      new SqlParameter {
                ParameterName = "@SortOrder", Value = i + 1, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.TinyInt
            }
                                      );
        }

        return(Json("Success"));
    }
Exemplo n.º 29
0
    private void LoadData()
    {
        Literal.Text = string.Empty;
        int      documentId = int.Parse(HttpContext.Current.Request.QueryString["id"]);
        Document Gymnast    = new Document(documentId);

        string        cn     = UmbracoCustom.GetParameterValue(UmbracoType.Connection);
        SqlDataReader reader = SqlHelper.ExecuteReader(cn, CommandType.StoredProcedure, "SelectChat",
                                                       new SqlParameter {
            ParameterName = "@GymnastId", Value = Gymnast.Id, Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int
        }
                                                       );

        while (reader.Read())
        {
            Literal.Text += string.Format("<div>{0}<br/>{1}</div>", Convert.ToDateTime(reader.GetValue(5)).ToShortDateString(), reader.GetValue(2));
        }
    }
Exemplo n.º 30
0
    private void GetPostUser(Post post)
    {
        User   user   = umbraco.BusinessLogic.User.GetCurrent();
        Member member = Member.GetCurrentMember();

        int    currentUser = user != null ? user.Id : member.Id;
        string type        = UmbracoCustom.PropertyValue(UmbracoType.UserType, post.UserType).ToLower();

        if (type == "trainer")
        {
            post.User    = new User(post.UserId).Name;
            post.IsOwner = currentUser == post.UserId;
        }
        else
        {
            post.User    = new Member(post.UserId).Text;
            post.IsOwner = currentUser == post.UserId;
        }
    }