Exemple #1
0
        void SetRadioGroupBindings(SerialView Serial, NavigatingCancelEventArgs e)
        {
            BindingOperations.ClearAllBindings((e.Content as SerialInfoPage).rbStopWatching);
            BindingOperations.ClearAllBindings((e.Content as SerialInfoPage).rbWatched);
            BindingOperations.ClearAllBindings((e.Content as SerialInfoPage).rbWatching);

            Binding bind = new Binding();

            bind.Source = Serial;
            bind.Path   = new PropertyPath("Watching");
            bind.Mode   = BindingMode.TwoWay;
            (e.Content as SerialInfoPage).rbWatching.SetBinding(RadioButton.IsCheckedProperty, bind);

            Binding bind2 = new Binding();

            bind2.Source = Serial;
            bind2.Path   = new PropertyPath("Watched");
            bind2.Mode   = BindingMode.TwoWay;
            (e.Content as SerialInfoPage).rbWatched.SetBinding(RadioButton.IsCheckedProperty, bind2);

            Binding bind3 = new Binding();

            bind3.Source = Serial;
            bind3.Path   = new PropertyPath("DontWatch");
            bind3.Mode   = BindingMode.TwoWay;
            (e.Content as SerialInfoPage).rbStopWatching.SetBinding(RadioButton.IsCheckedProperty, bind3);
        }
Exemple #2
0
        public SerialView GetSerial(int id)
        {
            SerialView temp = null;

            try
            {
                conn.Open();
                var comm = conn.CreateCommand();
                comm.CommandType = CommandType.StoredProcedure;
                comm.CommandText = "sp_get_serial";
                comm.Parameters.AddWithValue("@SerialId", id);
                var reader = comm.ExecuteReader();

                while (reader.Read())
                {
                    temp = new SerialView()
                    {
                        Id          = (int)reader["Id"],
                        Name        = reader["Name"].ToString(),
                        TVChannel   = reader["TVChannel"].ToString(),
                        Description = reader["Description"].ToString(),
                        Status      = reader["Status"].ToString(),
                        ImagePath   = String.IsNullOrEmpty(reader["Path"].ToString()) ? null : new Uri(reader["Path"].ToString(), UriKind.Absolute),
                        Seasons     = (Int16)reader["Seasons"],
                        Date        = (int)reader["Year"],
                        AverageMark = String.IsNullOrEmpty(reader["Average mark"].ToString()) ? null : (int?)reader["Average mark"],
                        //UserMark = String.IsNullOrEmpty(reader["Mark"].ToString()) ? null : (int?)reader["Mark"]
                    };
                }
            }
            catch (Exception ex)
            {
                string s = ex.Message;
            }
            finally
            {
                conn.Close();
            }
            return(temp);
        }