示例#1
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            string sRoleString = "";

            foreach (GridViewRow row in grvRoles.Rows)
            {
                if (((CheckBox)(row.Cells[2].FindControl("chkChoose"))).Checked)
                {
                    sRoleString += "@" + row.Cells[0].Text + "@";
                }
            }
            CategoryController catCont = new CategoryController();

            catCont.InsertRole(ddlCat.SelectedValue, sRoleString);
        }
        private void BindControls()
        {
            ArrayList tabs = DotNetNuke.Common.Globals.GetPortalTabs(PortalSettings.DesktopTabs, false, true, false, true);

            for (int i = 0; i < tabs.Count; i++)
            {
                DotNetNuke.Entities.Tabs.TabInfo tab = (DotNetNuke.Entities.Tabs.TabInfo)tabs[i];
                ddlDesktopListID.Items.Add(new ListItem(tab.TabName, tab.TabID.ToString()));
                ddlDesktopViewID.Items.Add(new ListItem(tab.TabName, tab.TabID.ToString()));
                ddlBookingPageID.Items.Add(new ListItem(tab.TabName, tab.TabID.ToString()));
            }
            ddlBookingPageID.Items.Insert(0, new ListItem("", "-1"));
            CategoryController catdb  = new CategoryController();
            string             sCatID = (Request.QueryString["id"] == null)?"":Request.QueryString["id"];
            DataTable          dt     = catdb.LoadTree(false, PortalId, sCatID);
            DataRow            row    = dt.NewRow();

            row["CatName"] = "";
            row["CatID"]   = 0;
            dt.Rows.InsertAt(row, 0);

            ddlParentID.DataSource     = dt;
            ddlParentID.DataTextField  = "CatName";
            ddlParentID.DataValueField = "CatID";
            ddlParentID.DataBind();

            if (Request.QueryString["id"] != null)
            {
                NewsController             newsCont = new NewsController();
                Dictionary <int, NewsInfo> dicNews  = newsCont.GetNewsByCat(Request.QueryString["id"]);
                ArrayList fLstNews = new ArrayList();
                NewsInfo  info     = new NewsInfo();
                info.ID       = 0;
                info.Headline = "";
                fLstNews.Add(info);
                foreach (NewsInfo fNewsInfo in dicNews.Values)
                {
                    fLstNews.Add(fNewsInfo);
                }
                ddlNews.DataSource     = fLstNews;
                ddlNews.DataTextField  = "Headline";
                ddlNews.DataValueField = "ID";
                ddlNews.DataBind();
            }
        }
        private void LoadDropdown()
        {
            CategoryController catdb = new CategoryController();
            DataTable          dt    = catdb.LoadTree(false, PortalId, "");

            ddlCategory.DataSource     = dt;
            ddlCategory.DataTextField  = "CatName";
            ddlCategory.DataValueField = "CatID";
            ddlCategory.DataBind();

            NewsGroupController groupCont = new NewsGroupController();
            DataTable           dt1       = groupCont.LoadTree(false, PortalId);

            ddlNewsGroup.DataSource     = dt1;
            ddlNewsGroup.DataTextField  = "NewsGroupName";
            ddlNewsGroup.DataValueField = "NewsGroupID";
            ddlNewsGroup.DataBind();
        }
示例#4
0
        private void BindCatDDL()
        {
            string[] cats = null;
            if (Settings["cats"] != null && Settings["cats"].ToString() != "")
            {
                cats = Settings["cats"].ToString().Split(new char[] { ',' }, StringSplitOptions.None);
            }
            CategoryController catCont = new CategoryController();
            CategoryInfo       cat;

            if (cats != null)
            {
                foreach (string c in cats)
                {
                    cat = catCont.Load(c);
                    ddlCat.Items.Add(new ListItem(cat.CatName, c));
                }
            }
        }
        private void LoadDropdown()
        {
            CategoryController catdb = new CategoryController();
            DataTable          dt    = catdb.LoadTree(false, PortalId, "");

            ddlCategory.DataSource     = dt;
            ddlCategory.DataTextField  = "CatName";
            ddlCategory.DataValueField = "CatID";
            ddlCategory.DataBind();

            string       strSQL = "News_getNewsGroupByPortal";
            SqlParameter para   = new SqlParameter("@PortalID", PortalId);
            DataTable    dt1    = DotNetNuke.NewsProvider.DataProvider.SelectSP(strSQL, para);

            ddlNewsGroup.DataSource     = dt1;
            ddlNewsGroup.DataTextField  = "NewsGroupName";
            ddlNewsGroup.DataValueField = "NewsGroupID";
            ddlNewsGroup.DataBind();
        }
示例#6
0
        protected void ddlCat_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            CategoryController catCont = new CategoryController();
            DataTable          tb      = catCont.LoadRolesByCat(ddlCat.SelectedValue);

            foreach (GridViewRow row in grvRoles.Rows)
            {
                ((CheckBox)(row.Cells[2].FindControl("chkChoose"))).Checked = false;
            }
            foreach (GridViewRow row in grvRoles.Rows)
            {
                foreach (DataRow dtRow in tb.Rows)
                {
                    if (row.Cells[0].Text == dtRow["RoleID"].ToString())
                    {
                        ((CheckBox)(row.Cells[2].FindControl("chkChoose"))).Checked = true;
                        break;
                    }
                }
            }
        }
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         CategoryController db = new CategoryController();
         int res = db.Delete(Request.QueryString["id"]);
         if (res == -1)
         {
             Page.ClientScript.RegisterClientScriptBlock(typeof(string), "deletefail", "<script language=javascript>window.alert('" + Localization.GetString("lblDeleteFail", Localization.GetResourceFile(this, "cat_edit.ascx")) + "');</script>");
         }
         else
         {
             string url = DotNetNuke.Common.Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "admin_cat", "mid/" + this.ModuleId.ToString());
             Response.Redirect(url);
         }
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
示例#8
0
 public override void LoadSettings()
 {
     try
     {
         if (!IsPostBack)
         {
             CategoryController catCont = new CategoryController();
             DataTable          tblCats = catCont.LoadTable(PortalId);
             lstChkCats.DataSource     = tblCats;
             lstChkCats.DataTextField  = "CatName";
             lstChkCats.DataValueField = "CatID";
             lstChkCats.DataBind();
         }
         if (ModuleSettings["pageSizeAdmin"] != null)
         {
             txtLimitAdmin.Text = ModuleSettings["pageSizeAdmin"].ToString();
         }
         if (ModuleSettings["cats"] != null && ModuleSettings["cats"].ToString() != "")
         {
             string[] cats;
             cats = ModuleSettings["cats"].ToString().Split(new char[] { ',' }, StringSplitOptions.None);
             foreach (string c in cats)
             {
                 foreach (ListItem l in lstChkCats.Items)
                 {
                     if (l.Value == c)
                     {
                         l.Selected = true;
                         break;
                     }
                 }
             }
         }
     }
     catch (Exception exc)
     {
         Exceptions.ProcessModuleLoadException(this, exc);
     }
 }
        public static MLCategoryInfo GetCategory(string catID, string Locale, bool FromCache)
        {
            StringInfo         CatName    = effority.Ealo.Controller.GetStringByQualifierAndStringName(CatQualifier, catID, Locale, FromCache);
            MLCategoryInfo     fMLCatInfo = null;
            CategoryController catCont    = new CategoryController();
            CategoryInfo       catInfo    = catCont.Load(catID);

            fMLCatInfo = new MLCategoryInfo(catInfo);
            if (CatName != null)
            {
                if (!String.IsNullOrEmpty(CatName.StringText))
                {
                    fMLCatInfo.MLCatName = CatName;
                }
            }
            //if (CatName!=null && String.IsNullOrEmpty(CatName.StringText))
            //{
            //    CatName.StringText = catInfo.CatName;
            //}
            //fMLCatInfo.MLCatName = CatName;
            return(fMLCatInfo);
        }
示例#10
0
        private void BindCatDDL()
        {
            CategoryController catdb = new CategoryController();
            DataTable          dt;

            //if (DotNetNuke.Security.PortalSecurity.IsInRole("Administrators"))
            //{
            dt = catdb.LoadTree(false, PortalId, "");
            //}
            //else
            //{
            //    dt = catdb.LoadTree(false, UserId, PortalId, "");
            //}
            DataRow catRow = dt.NewRow();

            catRow["CatName"] = "";
            catRow["CatID"]   = "0";
            dt.Rows.InsertAt(catRow, 0);
            ddlCat.DataSource     = dt;
            ddlCat.DataTextField  = "CatName";
            ddlCat.DataValueField = "CatID";
            ddlCat.DataBind();
        }
        private void LoadDropdown()
        {
            string path = PortalSettings.HomeDirectoryMapPath + "Xsl";

            DotNetNuke.NewsProvider.Utils.BindTemplateByName(ddlTemplate, path, "news_list*.xsl");

            CategoryController catdb = new CategoryController();
            DataTable          dt    = catdb.LoadTree(false, PortalId, "");

            ddlCategory.DataSource     = dt;
            ddlCategory.DataTextField  = "CatName";
            ddlCategory.DataValueField = "CatID";
            ddlCategory.DataBind();

            string       strSQL = "News_getNewsGroupByPortal";
            SqlParameter para   = new SqlParameter("@PortalID", PortalId);
            DataTable    dt1    = DotNetNuke.NewsProvider.DataProvider.SelectSP(strSQL, para);

            ddlNewsGroup.DataSource     = dt1;
            ddlNewsGroup.DataTextField  = "NewsGroupName";
            ddlNewsGroup.DataValueField = "NewsGroupID";
            ddlNewsGroup.DataBind();
        }
示例#12
0
        protected void btnSavePreview_Click(object sender, EventArgs e)
        {
            try
            {
                NewsInfo news = new NewsInfo();
                if (Request.QueryString["id"] != null)
                {
                    news.ID = Convert.ToInt32(Request.QueryString["id"]);
                }
                else if (lblNewsID.Text != "")
                {
                    news.ID = Convert.ToInt32(lblNewsID.Text);
                }
                else
                {
                    news.ID = 0;
                }
                news.CatID       = ddlCategory.SelectedValue;
                news.Content     = Server.HtmlDecode(teContent.Text);
                news.CreateID    = this.UserId;
                news.ModifyID    = this.UserId;
                news.Description = Server.HtmlDecode(txtDescription.Text);

                if (chkImageURL.Checked)
                {
                    NewsController newsCont = new NewsController();
                    DataTable      dt       = newsCont.GetFileInfo(int.Parse(ctlURL.Url.Substring(7)));
                    if (dt.Rows.Count == 1)
                    {
                        string imagePath = PortalSettings.HomeDirectory + dt.Rows[0]["Folder"].ToString() + dt.Rows[0]["FileName"].ToString();
                        news.ImageUrl = imagePath + ";" + ctlURL.Url;
                        Resize(imagePath, 600);
                    }
                }
                else
                {
                    news.ImageUrl = "";
                }

                news.Headline     = txtHeadline.Text;
                news.AllowComment = chkAllowComment.Checked;
                news.Published    = chkPublished.Checked;
                news.KeyWords     = txtKeyWords.Text.Trim();
                news.ModifyDate   = Convert.ToDateTime(txtModifyDate.Text);
                news.StartDate    = txtStartDate.Text == "" ? (DateTime?)null : Convert.ToDateTime(txtStartDate.Text);
                news.EndDate      = txtEndDate.Text == "" ? (DateTime?)null : Convert.ToDateTime(txtEndDate.Text);
                if (chkNew.Checked)
                {
                    news.Feature += 1;
                }
                if (chkHot.Checked)
                {
                    news.Feature += 2;
                }
                news.Writer = txtWriter.Text;
                if (txtDonVi.Text == "")
                {
                    news.DonVi = PortalSettings.PortalName;
                }
                else
                {
                    news.DonVi = txtDonVi.Text;
                }
                news.FromOuter = chkFromOuter.Checked;

                NewsController db = new NewsController();
                if (news.ID != 0)
                {
                    db.Update(news);
                }
                else
                {
                    db.Insert(news);
                }

                string NewsGroupString = "";
                foreach (ListItem item in lstChkNewsGroup.Items)
                {
                    if (item.Selected == true)
                    {
                        NewsGroupString += "@" + item.Value + "@";
                        if (item.Value == "__Shared__" && hdShared.Value == "0")
                        {
                            SendMailToSuperUser(new string[] { "*****@*****.**" }, news.Headline);
                            hdShared.Value = "1";
                        }
                    }
                }
                db.UpdateNewsGroupNews(news.ID, NewsGroupString);

                btnDelete.Visible = true;
                btnDelete.Attributes["onclick"] = "if(!confirm('" + Localization.GetString("lblConfirmDelete", Localization.GetResourceFile(this, "news_edit.ascx")) + "')) {return false;};";
                lblNewsID.Text = news.ID.ToString();

                //Resize image
                string          pattern = "(?<=<img[^<]+?src=\")[^\"]+";
                MatchCollection mc      = Regex.Matches(news.Content, pattern, RegexOptions.Multiline);
                foreach (Match m in mc)
                {
                    Resize(m.Value, 600);
                }
                //Resize image

                CategoryController catCont    = new CategoryController();
                CategoryInfo       catInfo    = catCont.Load(news.CatID);
                string             previewUrl = DotNetNuke.Common.Globals.NavigateURL(catInfo.DesktopViewID, "", "id/" + news.ID.ToString());
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "preview", "window.open('" + previewUrl + "','','width=800,height=600,scrollbars=1')", true);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }