示例#1
0
        protected void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtTitle.Text.Trim() == "")
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Err", "alert('Please enter title !')", true);
                    return;
                }
                BaseHandler bh = new BaseHandler();
                List<object> cmpData = new List<object>();
                PluggContainer pc = new PluggContainer(new Localization().CurrentCulture);
                pc.ThePlugg.CreatedByUserId = this.UserId;
                pc.ThePlugg.ModifiedByUserId = this.UserId;
                pc.ThePlugg.PluggId = 0;
                pc.SetTitle(txtTitle.Text);
                string subjectStr = Page.Request.QueryString["s"];
                if (subjectStr != null)
                {
                    int subid = Convert.ToInt32(subjectStr);
                    pc.ThePlugg.SubjectId = subid;
                }
                    else
                pc.ThePlugg.SubjectId = 0;

                pc.SetDescription(txtDescription.Text);
                pc.ThePlugg.WhoCanEdit = (EWhoCanEdit)Enum.Parse(typeof(EWhoCanEdit), rdbtnWhoCanEdit.SelectedValue);

                bh.CreateBasicPlugg(pc);
                txtTitle.Text = "";
                txtDescription.Text = "";
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Success", "alert('New Plugg is created successfully')", true);
            }
            catch (Exception ex)
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Error", "alert('Error : " + ex.Message + "')", true);
            }
        }
示例#2
0
 private void CreatePlugg()
 {
     string cultureCode = (Page as DotNetNuke.Framework.PageBase).PageCulture.Name;
     PluggContainer pc = new PluggContainer(cultureCode);
     pc.ThePlugg.CreatedByUserId = UserId;
     pc.ThePlugg.ModifiedByUserId = UserId;
     pc.ThePlugg.PluggId = 0;
     pc.ThePlugg.CreatedInCultureCode = cultureCode;
     pc.SetTitle(Regex.Replace(nvc["Title"], "<[^>]*>", String.Empty));
     //string subjectStr = Page.Request.QueryString["s"];
     //if (subjectStr != null)
     //{
     //    int subid = Convert.ToInt32(subjectStr);
     //    pc.ThePlugg.SubjectId = subid;
     //}
     //else
     //    pc.ThePlugg.SubjectId = 0;
     pc.ThePlugg.SubjectId = 0;
     if (nvc["Description"] != "")
         pc.SetDescription(Regex.Replace(nvc["Description"], "<[^>]*>", String.Empty));
     pc.ThePlugg.WhoCanEdit = EWhoCanEdit.Anyone;
     BaseHandler bh = new BaseHandler();
     bh.CreateBasicPlugg(pc);
     Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(pc.ThePlugg.TabId, "", "edit=0"));
 }