private void SaveScriptData()
    {
        try
        {
            ScriptInjectionInfo obj = new ScriptInjectionInfo();
            if (Session["ScriptId"] != null && Session["ScriptId"].ToString() != string.Empty)
            {
                obj.ScriptID = Int32.Parse(Session["ScriptId"].ToString());
                Session.Contents.Remove("ScriptId");
            }
            else
            {
                obj.ScriptID = 0;
            }

            if (txtScriptName.Text != string.Empty && txtScriptDescription.Text != string.Empty && txtScriptContent.Text != string.Empty)
            {
                string Ext = System.IO.Path.GetExtension(txtScriptName.Text);
                if (Ext == ".html")
                {
                    obj.ScriptName = txtScriptName.Text;
                }
                else
                {
                    obj.ScriptName = txtScriptName.Text + ".html";
                }
                obj.ScriptToBeEmbed   = txtScriptContent.Text;
                obj.ScriptDescription = txtScriptDescription.Text;
                obj.UserModuleID      = Int32.Parse(SageUserModuleID);
                obj.PortalID          = GetPortalID;
                obj.IsVisible         = true;
            }

            if (txtScriptName.Text != string.Empty && txtScriptDescription.Text != string.Empty && txtScriptContent.Text != string.Empty)
            {
                ScriptInjectionController objC = new ScriptInjectionController();
                objC.SaveScriptData(obj);
                ShowMessage(SageMessageTitle.Information.ToString(), SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/ScriptInjection/ModuleLocalText", "SavedSucessfully"), "", SageMessageType.Success);
                divScriptContainer.Attributes.Add("style", "display:block");
                divScriptForm.Attributes.Add("style", "display:none");
                loadOngdvScriptTobeEmbed(Int32.Parse(SageUserModuleID));
            }
            else
            {
                ShowMessage(SageMessageTitle.Information.ToString(), SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/ScriptInjection/ModuleLocalText", "PleaseFillTheFormFirst"), "", SageMessageType.Success);
                divScriptContainer.Attributes.Add("style", "display:none");
                divScriptForm.Attributes.Add("style", "display:block");
            }
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }
 private void EditScript(int ScriptId)
 {
     try
     {
         divScriptContainer.Attributes.Add("style", "display:none");
         divScriptForm.Attributes.Add("style", "display:block");
         ScriptInjectionController objC   = new ScriptInjectionController();
         ScriptInjectionInfo       objInf = new ScriptInjectionInfo();
         objInf = objC.GetSCriptToBeEdit(ScriptId);
         txtScriptContent.Text     = objInf.ScriptToBeEmbed;
         txtScriptName.Text        = objInf.ScriptName;
         txtScriptDescription.Text = objInf.ScriptDescription;
         Session["ScriptId"]       = ScriptId;
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }