コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthorController ac = new AuthorController();

            rptAuthors.DataSource = ac.GetAuthors();
            rptAuthors.DataBind();
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                AuthorController ac = new AuthorController();
                ddlAuthorId.DataSource     = ac.GetAuthors();
                ddlAuthorId.DataTextField  = "AuthorName";
                ddlAuthorId.DataValueField = "AuthorID";
                ddlAuthorId.DataBind();


                LanguageController lc = new LanguageController();
                ddlLanguageId.DataSource     = lc.GetLanguages();
                ddlLanguageId.DataTextField  = "LanguageTitle";
                ddlLanguageId.DataValueField = "LanguageID";
                ddlLanguageId.DataBind();


                SourceController sc = new SourceController();
                ddlSourceId.DataSource     = sc.GetSources();
                ddlSourceId.DataTextField  = "SourceTitle";
                ddlSourceId.DataValueField = "SourceId";

                NewsController nc = new NewsController();
                ddlAuthorId.SelectedValue   = nc.Author_Id.ToString();
                ddlLanguageId.SelectedValue = nc.LanguageID.ToString();
                ddlSourceId.SelectedValue   = nc.Source.ToString();

                Uri    myUri  = new Uri(Request.Url.ToString());
                string NewsId = HttpUtility.ParseQueryString(myUri.Query).Get("ID");
                if (NewsId == null)
                {
                    Response.Redirect("ListNews.aspx");
                }
                nc.GetNew(int.Parse(NewsId));
                NewsTitle.Text        = nc.NewsTitle;
                NewsSubtitle.Text     = nc.NewsSubtitle;
                NewsDescription.Value = nc.NewsDescription;
                PublishedDate.Text    = nc.Published_Date;
                First_AD.Text         = nc.First_AD;
                Second_AD.Text        = nc.Second_AD;
                Third_AD.Text         = nc.Third_AD;
                Fourth_AD.Text        = nc.Fourth_AD;
                Fifth_AD.Text         = nc.Fifth_AD;
                Sixth_AD.Text         = nc.Sixth_AD;
                if (nc.Break_News == false)
                {
                    Break_News.Checked = false;
                }
                else
                {
                    Break_News.Checked = true;
                }
                Youtube_Url.Text = nc.Youtube_Url;
            }
        }
コード例 #3
0
        protected void Delete_Click(object sender, EventArgs e)
        {
            LinkButton       btn      = (LinkButton)sender;
            int              AuthorID = int.Parse(btn.CommandArgument);
            AuthorController ac       = new AuthorController();

            ac.DeleteAuthor(AuthorID);
            rptAuthors.DataSource = ac.GetAuthors();
            rptAuthors.DataBind();
        }
コード例 #4
0
        private void FillList()
        {
            cAuthors    = _authorController.GetAuthors();
            cPublishers = _publisherController.GetPublishers();

            cmbAuthor.ValueMember   = "AuthorID";
            cmbAuthor.DisplayMember = "FirstName" + "LastName";
            cmbAuthor.DataSource    = cAuthors;

            cmbPublisher.ValueMember   = "PublisherID";
            cmbPublisher.DisplayMember = "PublisherName";
            cmbPublisher.DataSource    = cPublishers;
        }
コード例 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                MenuController mc = new MenuController();
                ddlMenuID.DataSource     = mc.GetParentMenus();
                ddlMenuID.DataTextField  = "Title";
                ddlMenuID.DataValueField = "MenuID";
                ddlMenuID.DataBind();
                ddlMenuID.Items.Insert(0, new ListItem("Root Menus", "0"));

                AlbumController ac = new AlbumController();
                ddlAlbumID.DataSource     = ac.GetAlbums();
                ddlAlbumID.DataTextField  = "EnglishAlbumName";
                ddlAlbumID.DataValueField = "AlbumID";
                ddlAlbumID.DataBind();
                ddlAlbumID.Items.Insert(0, "Select Albums");

                LanguageController lc = new LanguageController();
                ddlLanguageID.DataSource     = lc.GetLanguages();
                ddlLanguageID.DataTextField  = "LanguageTitle";
                ddlLanguageID.DataValueField = "LanguageID";
                ddlLanguageID.DataBind();
                ddlLanguageID.Items.Insert(0, "Select Languages");

                CategoryController cc = new CategoryController();
                ddlCategoryID.DataSource     = cc.GetParentCategory();
                ddlCategoryID.DataTextField  = "CategoryName";
                ddlCategoryID.DataValueField = "CategoryID";
                ddlCategoryID.DataBind();
                ddlCategoryID.Items.Insert(0, new ListItem("Root Category", "0"));

                AuthorController auc = new AuthorController();
                ddlAuthorID.DataSource     = auc.GetAuthors();
                ddlAuthorID.DataTextField  = "AuthorName";
                ddlAuthorID.DataValueField = "AuthorID";
                ddlAuthorID.DataBind();
                ddlAuthorID.Items.Insert(0, "List Authors");

                chkPublished.Checked = true;
            }
        }
コード例 #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         AuthorController ac = new AuthorController();
         ddlAuthorId.DataSource     = ac.GetAuthors();
         ddlAuthorId.DataTextField  = "AuthorName";
         ddlAuthorId.DataValueField = "AuthorID";
         ddlAuthorId.DataBind();
         ddlAuthorId.Items.Insert(0, new ListItem("Root Author", "0"));
         LanguageController lc = new LanguageController();
         ddlLanguageId.DataSource     = lc.GetLanguages();
         ddlLanguageId.DataTextField  = "LanguageTitle";
         ddlLanguageId.DataValueField = "LanguageID";
         ddlLanguageId.DataBind();
         ddlLanguageId.Items.Insert(0, new ListItem("Root Language", "0"));
         SourceController sc = new SourceController();
         ddlSourceId.DataSource     = sc.GetSources();
         ddlSourceId.DataTextField  = "SourceTitle";
         ddlSourceId.DataValueField = "SourceId";
         ddlSourceId.Items.Insert(0, new ListItem("Root Source", "0"));
         Break_News.Checked = true;
     }
 }
コード例 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                MenuController mc = new MenuController();
                ddlMenuID.DataSource     = mc.GetParentMenus();
                ddlMenuID.DataTextField  = "Title";
                ddlMenuID.DataValueField = "MenuID";
                ddlMenuID.DataBind();
                ddlMenuID.Items.Insert(0, new ListItem("Root Menus", "0"));

                AlbumController ac = new AlbumController();
                ddlAlbumID.DataSource     = ac.GetAlbums();
                ddlAlbumID.DataTextField  = "EnglishAlbumName";
                ddlAlbumID.DataValueField = "AlbumID";
                ddlAlbumID.DataBind();
                ddlAlbumID.Items.Insert(0, new ListItem("Select Album", "0"));

                LanguageController lc = new LanguageController();
                ddlLanguageID.DataSource     = lc.GetLanguages();
                ddlLanguageID.DataTextField  = "LanguageTitle";
                ddlLanguageID.DataValueField = "LanguageID";
                ddlLanguageID.DataBind();
                ddlLanguageID.Items.Insert(0, new ListItem("Select Language", "0"));

                CategoryController cc = new CategoryController();
                ddlCategoryID.DataSource     = cc.GetParentCategory();
                ddlCategoryID.DataTextField  = "CategoryName";
                ddlCategoryID.DataValueField = "CategoryID";
                ddlCategoryID.DataBind();
                ddlCategoryID.Items.Insert(0, new ListItem("Root Category", "0"));

                AuthorController auc = new AuthorController();
                ddlAuthorID.DataSource     = auc.GetAuthors();
                ddlAuthorID.DataTextField  = "AuthorName";
                ddlAuthorID.DataValueField = "AuthorID";
                ddlAuthorID.DataBind();
                ddlAuthorID.Items.Insert(0, new ListItem("Select Author", "0"));

                ContentController oc = new ContentController();
                //Check if no paratmeter exist, redirect to list page.
                Uri    myUri     = new Uri(Request.Url.ToString());
                string ContentID = HttpUtility.ParseQueryString(myUri.Query).Get("ID");
                if (ContentID == null)
                {
                    Response.Redirect("/UserControl/Template/Content/ListContent.aspx");
                }
                oc.GetContent(int.Parse(ContentID));
                txtContentTitle.Text                   = oc.ContentTitle;
                txtContentSubTitle.Text                = oc.ContentSubTitle;
                PublishedDate.Text                     = Convert.ToDateTime(oc.PublishedDate).Date.ToString("yyyy-MM-dd");
                chkPublished.Checked                   = oc.IsPublished;
                ddlMenuID.SelectedValue                = oc.MenuID.ToString();
                ddlAlbumID.SelectedValue               = oc.AlbumID.ToString();
                ddlLanguageID.SelectedValue            = oc.LanguageID.ToString();
                txtStartDateTime.Text                  = Convert.ToDateTime(oc.StartDateTime).Date.ToString("yyyy-MM-ddTHH:mm");
                txtEndDateTime.Text                    = Convert.ToDateTime(oc.EndDateTime).Date.ToString("yyyy-MM-ddTHH:mm");
                ddlAuthorID.SelectedValue              = oc.AuthorID.ToString();
                ddlCategoryID.SelectedValue            = oc.ContentCategoryID.ToString();
                txtMetaTitle.Text                      = oc.MetaTitle;
                txtMetaKeyword.Text                    = oc.MetaKeyword;
                MetaDescription.Value                  = oc.MetaDescription;
                lblFileUploadContentImagePath.Text     = oc.UploadContentImage;
                lblFileUploadContentFilePath.Text      = oc.UploadContentFile;
                lblFileUploadThumbnailContentPath.Text = oc.UploadThumbnailContentImage;
                txtSummary.Text     = oc.Summary;
                txtCustomText1.Text = oc.CustomText1;
                txtCustomText2.Text = oc.CustomText2;
                txtCustomText3.Text = oc.CustomText3;
                Description.Value   = oc.Description;
            }
        }