Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ddlDirector.DataSource     = DirectorRepository.GetAllDirectors();
         ddlDirector.DataTextField  = "DirectorName";
         ddlDirector.DataValueField = "DirectorID";
         ddlDirector.DataBind();
         ddlTypes.DataSource     = TypeRepository.GetAllTypes();
         ddlTypes.DataTextField  = "TypeName";
         ddlTypes.DataValueField = "TypeID";
         ddlTypes.DataBind();
         if (Request.QueryString["ID"] != null)
         {
             Film _film = FilmRepository.GetFilm(int.Parse(Request.QueryString["ID"]));
             txtFilmDescription.Text   = _film.Description;
             ddlDirector.SelectedValue = _film.DirectorID.ToString();
             ddlTypes.SelectedValue    = _film.TypeID.ToString();
             txtFilmName.Text          = _film.FilmName;
             calender1.VisibleDate     = _film.PublishDate;
             calender1.SelectedDate    = _film.PublishDate.Date;
             btnKaydet.Text            = "Güncelle";
         }
     }
 }
Пример #2
0
        public ActionResult TypeChart()
        {
            TypeChartViewModel typeChart = new TypeChartViewModel();

            //get all TypeMatchups
            TypeRepository allTypes = new TypeRepository(TypeRepository.GetAllTypes());

            typeChart.TypeMatchups = new Dictionary <String, Dictionary <String, Double> >();

            foreach (var matchup in allTypes.GetTypeMatchups())
            {
                //add key if doesn't exist
                if (!typeChart.TypeMatchups.ContainsKey(matchup.AttackingType))
                {
                    typeChart.TypeMatchups.Add(matchup.AttackingType, new Dictionary <String, Double>());
                }

                //add matchup
                typeChart.TypeMatchups[matchup.AttackingType].Add(matchup.DefendingType, matchup.Modifier);
            }

            //Get all types as String
            typeChart.allTypes = new List <string>();
            foreach (Models.PKM.Type type in TypeRepository.GetAllTypes())
            {
                typeChart.allTypes.Add(type.Name);
            }

            ViewBag.TypeChart = typeChart;

            return(View("TypeChart"));
        }
Пример #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Repeater1.DataSource = FilmRepository.GetAllFilms();
     Repeater1.DataBind();
     if (!IsPostBack)
     {
         ddlType.DataSource     = TypeRepository.GetAllTypes();
         ddlType.DataTextField  = "TypeName";
         ddlType.DataValueField = "TypeID";
         ddlType.DataBind();
         ddlDirector.DataSource     = DirectorRepository.GetAllDirectors();
         ddlDirector.DataTextField  = "DirectorName";
         ddlDirector.DataValueField = "DirectorID";
         ddlDirector.DataBind();
         ddlType.Items.Add("Hepsi");
         ddlType.SelectedIndex = ddlType.Items.Count - 1;
         ddlDirector.Items.Add("Hepsi");
         ddlDirector.SelectedIndex = ddlDirector.Items.Count - 1;
     }
     if (Request.QueryString["filmID"] != null)
     {
         FilmRepository.DeleteFilm(int.Parse(Request.QueryString["filmID"]));
     }
     if (Request.QueryString["directorID"] != null)
     {
         ddlDirector.SelectedValue = Request.QueryString["directorID"];
         ddlDirector_SelectedIndexChanged(sender, e);
         ddlDirector.Enabled = false;
         return;
     }
 }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ddlDirector.DataSource     = DirectorRepository.GetAllDirectors();
            ddlDirector.DataTextField  = "DirectorName";
            ddlDirector.DataValueField = "DirectorID";
            ddlDirector.DataBind();
            ddlTypes.DataSource     = TypeRepository.GetAllTypes();
            ddlTypes.DataTextField  = "TypeName";
            ddlTypes.DataValueField = "TypeID";
            ddlTypes.DataBind();
            Film _film = FilmRepository.GetFilm(int.Parse(Request.QueryString["ID"]));

            txtFilmDescription.Text   = _film.Description;
            txtFilmName.Text          = _film.FilmName;
            txtPublishDate.Text       = _film.PublishDate.ToString();
            ddlDirector.SelectedValue = _film.DirectorID.ToString();
            ddlTypes.SelectedValue    = _film.TypeID.ToString();
        }