Example #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);
            }
        }