Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var id = Request.QueryString["id"];

            if (!string.IsNullOrEmpty(id))
            {
                itemid = Int32.Parse(id);
                if (!IsPostBack)
                {
                    MediaBAL bal = new MediaBAL();
                    MediaGroup group = bal.GetMediaGroup(itemid);

                    MediaGroupTitle.Text = group.MediaTitle;

                    BindData();

                }
            }

            var assetid = Request.QueryString["assetid"];
            if (!string.IsNullOrEmpty(assetid))
            {
                if (!IsPostBack)
                {
                    BindData();

                    MediaBAL bal = new MediaBAL();
                    MediaGroupItem mediagroupitem = bal.GetMediaGroupItem(assetid.ToString());
                    txtVideoTitle.Text = mediagroupitem.FileName;
                    txtVideoFilePath.Text = mediagroupitem.FilePath;
                    txtAssetID.Text = mediagroupitem.AssetID;
                    txtPermanentLink.Text = mediagroupitem.PermanentLinkURL;
                    txtVideoPrevImage.Text = mediagroupitem.PreviewImageURL;
                    Sort.Text = mediagroupitem.Sort.ToString();
                }

            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            txtMediaTitle.Visible = false;
            lstMediaType.Visible = false;
            chkActive.Visible = false;

            lblMediaTitle.Visible = false;
            lblMediaType.Visible = false;
            lblActive.Visible = false;
            txtProductID.Visible = false;
            lblProductID.Visible = false;

            btnSave.Visible = false;
            btnCancel.Visible = false;

            if (!IsPostBack)
            {
                lstMediaType.Items.Add("Audio");
                lstMediaType.Items.Add("Video");
                BindData();

                var action = Request.QueryString["action"];

                if (action != null)
                {
                    if (action == "e")
                    {

                        //edit
                        var id = Request.QueryString["id"];
                         if (!string.IsNullOrEmpty(id))
                         {
                             if(Helper.IsNumeric(id))
                             {
                                ViewState["MediaID"] = id;
                                MediaBAL bal = new MediaBAL();
                                MediaGroup mediagroup = bal.GetMediaGroup(Int32.Parse(id));
                                txtMediaTitle.Text = mediagroup.MediaTitle;
                                txtProductID.Text = mediagroup.ProductID.ToString();
                                lstMediaType.SelectedValue = mediagroup.MediaType;
                                chkActive.Checked = mediagroup.Active;

                                txtMediaTitle.Visible = true;
                                lstMediaType.Visible = true;
                                chkActive.Visible = true;
                                lblMediaTitle.Visible = true;
                                lblMediaType.Visible = true;
                                lblActive.Visible = true;
                                btnSave.Visible = true;
                                btnCancel.Visible = true;
                                txtProductID.Visible = true;
                                lblProductID.Visible = true;

                             }
                         }

                    }

                    if (action == "d")
                    {
                        //delete

                        var id = Request.QueryString["id"];
                        if (!string.IsNullOrEmpty(id))
                        {
                            if (Helper.IsNumeric(id))
                            {
                                ViewState["MediaID"] = id;
                                MediaBAL bal = new MediaBAL();
                                bal.DeleteMediaGroup(Int32.Parse(id));

                                BindData();

                                Response.Redirect("/editvideomain.aspx");

                            }
                        }

                    }

                }

            }
        }