Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        String _storId = Request.QueryString["storId"];

        if (!String.IsNullOrEmpty(_storId))
        {
            Stories _st = new Stories(ConfigurationManager.ConnectionStrings["TopRockConnection"].ConnectionString);
            _st.LitePopulate(_storId);

            if (!String.IsNullOrEmpty(CommonUtility.NullSafeString(_st.YouTubeLink, "").Trim()))
            {
                Literal _li = new Literal();
                _li.Text = _st.YouTubeLink;
                secureHolder.Controls.Add(_li);
            }
            else
            {
                if (!String.IsNullOrEmpty(CommonUtility.NullSafeString(_st.ImgType, "").Trim()))
                {
                    Image _img = new Image();
                    _img.ImageUrl = String.Format(ConfigurationManager.AppSettings["StoriesImagesPath"], _st.ID.ToString(), _st.ImgType);
                    secureHolder.Controls.Add(_img);
                }
            }

        }
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            String _stId = Request.QueryString["source"];
            if (!String.IsNullOrEmpty(_stId))
            {
                Stories _st = new Stories(this.ConnectionString);
                _st.LitePopulate(_stId, false, null);

                if (!_st.IsEmpty())
                {
                    lbl_Story.Text = _st.Story;
                    lbl_Title.Text = _st.Title;
                    tText.Text = "so.addVariable(\"text\",\"STORIES FROM THE TOP - <font size='22'>" + _st.CategoryDescription.ToUpper() + "</font>\")";

                    if (!String.IsNullOrEmpty(CommonUtility.NullSafeString(_st.YouTubeLink, "").Trim()))
                    {
                        div_Holder.InnerHtml = _st.YouTubeLink;
                    }
                    else
                    {
                        if (!String.IsNullOrEmpty(CommonUtility.NullSafeString(_st.ImgType, "").Trim()))
                        {
                            Image _img = new Image();
                            _img.ImageUrl = String.Format(ConfigurationManager.AppSettings["StoriesImagesPath"], _st.ID.ToString(), _st.ImgType);
                            div_Holder.Controls.Add(_img);
                        }
                        else
                        {
                            div_Holder.Visible = false;
                        }
                    }
                }
                else
                {
                    Response.Redirect("stotieslist.aspx");
                }

            }
            else
            {
                Response.Redirect("stotieslist.aspx");
            }
        }
    }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            HtmlGenericControl _nc = (HtmlGenericControl)Master.FindControl("navHistory");
            _nc.Attributes.Add("class", "active");

            StoryCategoriesCollection<StoryCategories> _cat = new StoryCategoriesCollection<StoryCategories>(this.ConnectionString);
            _cat.LitePopulate(new CoreLibrary.ArgumentsList());

            dd_Category.DataSource = _cat;
            dd_Category.DataTextField = "Description";
            dd_Category.DataValueField = "ID";
            dd_Category.DataBind();
            dd_Category.Items.Insert(0, new ListItem("---- Select One ----", ""));

            dd_Status.DataSource = this.LogedInUser.GetAllStatuses();
            dd_Status.DataTextField = "Description";
            dd_Status.DataValueField = "ID";
            dd_Status.DataBind();

            String _storId = Request.QueryString["storId"];
            if (!String.IsNullOrEmpty(_storId))
            {
                ViewState.Add("storId", _storId);

                Stories _stor = new Stories(this.ConnectionString);
                _stor.LitePopulate(_storId, false);

                if (dd_Category.Items.FindByValue(_stor.CategoryId.ToString()) != null)
                {
                    dd_Category.Items.FindByValue(_stor.CategoryId.ToString()).Selected = true;
                }

                txt_Title.Text = HttpUtility.HtmlDecode(_stor.Title);
                txt_Story.Text = HttpUtility.HtmlDecode(_stor.Story);
                txt_YouTube.Text = _stor.YouTubeLink;
                if (dd_Status.Items.FindByValue(_stor.Status.ToString()) != null)
                {
                    dd_Status.Items.FindByValue(_stor.Status.ToString()).Selected = true;
                }
            }
        }
    }
Exemplo n.º 4
0
 protected void Publish_Click(Object sender, EventArgs e)
 {
     Stories _st = null;
     foreach (GridViewRow I in dgStories.Rows)
     {
         Label _id = (Label)I.FindControl("lbl_StorId");
         if (_id != null)
         {
             DropDownList _ddst = (DropDownList)I.FindControl("dd_Status");
             _st = new Stories(this.ConnectionString);
             _st.LitePopulate(_id.Text, false);
             if (!_st.Status.ToString().Equals(_ddst.SelectedValue))
             {
                 _st.Status = Convert.ToInt32(_ddst.SelectedValue);
                 _st.Save();
             }
         }
     }
     this.DataBind();
 }
Exemplo n.º 5
0
    protected void Save_Click(object sender, EventArgs e)
    {
        Stories _stor = new Stories(this.ConnectionString);
        if (ViewState["storId"] != null)
        {
            _stor.LitePopulate(Convert.ToInt32(ViewState["storId"]), false);
        }

        if (IsValidStory(_stor))
        {

            _stor.Title = HttpUtility.HtmlEncode(txt_Title.Text);
            _stor.Story = HttpUtility.HtmlEncode(txt_Story.Text);
            _stor.Status = Convert.ToInt32(dd_Status.SelectedValue);

            _stor.CategoryId = Convert.ToInt32(dd_Category.SelectedValue);

            String _imgType = null;
            if (ViewState["storId"] != null)
            {
                if (fu_Image.HasFile)
                {
                    _stor.YouTubeLink = "";
                    _imgType = fu_Image.FileName.Split('.')[1];
                    _stor.ImgType = _imgType;
                }
                else
                {
                    if (!String.IsNullOrEmpty(txt_YouTube.Text))
                    {
                        _stor.YouTubeLink = GetYouTubeLink();
                        _stor.ImgType = "";
                    }
                }
            }
            else
            {
                if (fu_Image.HasFile)
                {
                    _stor.YouTubeLink = "";
                    _imgType = fu_Image.FileName.Split('.')[1];
                    _stor.ImgType = _imgType;
                }
                else
                {
                    _stor.YouTubeLink = GetYouTubeLink();
                    _stor.ImgType = "";
                }
            }

            if (_stor.Save())
            {
                if (fu_Image.HasFile)
                {
                    String _path = Server.MapPath(String.Format(ConfigurationManager.AppSettings["StoriesImagesPath"], _stor.ID.ToString(), _imgType));
                    fu_Image.SaveAs(_path);
                }
                this.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyScript", "alert('Record has been updated successfully.');self.location = 'StoriesList.aspx';", true);
            }
            else
            {
                lbl_Error.Text = "An unexpected error has occurred. Please try again.";
                lbl_Error.Visible = true;
            }
        }
    }