/// ----------------------------------------------------------------------------- /// <summary> /// Page_Load runs when the control is loaded /// </summary> /// <remarks> /// </remarks> /// <history> /// </history> /// ----------------------------------------------------------------------------- protected void Page_Load(System.Object sender, System.EventArgs e) { try { if (!Page.IsPostBack) { if (((string)Settings["template"] != null) && ((string)Settings["template"] != "")) strTemplate = (string)Settings["template"]; else strTemplate = Localization.GetString("Template.Text", LocalResourceFile); SSMTestUserControlController objSSMTestUserControls = new SSMTestUserControlController(); List<SSMTestUserControlInfo> colSSMTestUserControls; bindGrid(); //grdSchool.DataSource = dt; //grdSchool.DataBind(); // Response.Redirect(dt.Rows.Count.ToString()); ////get the content from the SSMTestUserControl table //colSSMTestUserControls = objSSMTestUserControls.GetSSMTestUserControls(ModuleId); //if (colSSMTestUserControls.Count == 0) //{ // //add the content to the SSMTestUserControl table // SSMTestUserControlInfo objSSMTestUserControl = new SSMTestUserControlInfo(); // objSSMTestUserControl.ModuleId = ModuleId; // objSSMTestUserControl.Content = Localization.GetString("DefaultContent", LocalResourceFile); // objSSMTestUserControl.CreatedByUser = this.UserId; // objSSMTestUserControls.AddSSMTestUserControl(objSSMTestUserControl); // //get the content from the SSMTestUserControl table // colSSMTestUserControls = objSSMTestUserControls.GetSSMTestUserControls(ModuleId); //} } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
/// ----------------------------------------------------------------------------- /// <summary> /// Page_Load runs when the control is loaded /// </summary> /// <remarks> /// </remarks> /// <history> /// </history> /// ----------------------------------------------------------------------------- protected void Page_Load(System.Object sender, System.EventArgs e) { try { //Determine ItemId of SSMTestUserControl to Update if (this.Request.QueryString["ItemId"] != null) { ItemId = Int32.Parse(this.Request.QueryString["ItemId"]); } //If this is the first visit to the page, bind the role data to the datalist if (Page.IsPostBack == false) { cmdDelete.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');"); if (ItemId != -1) { //get content SSMTestUserControlController objSSMTestUserControls = new SSMTestUserControlController(); SSMTestUserControlInfo objSSMTestUserControl = objSSMTestUserControls.GetSSMTestUserControl(ModuleId, ItemId); if (objSSMTestUserControl != null) { txtContent.Text = objSSMTestUserControl.Content; ctlAudit.CreatedByUser = objSSMTestUserControl.CreatedByUser.ToString(); ctlAudit.CreatedDate = objSSMTestUserControl.CreatedDate.ToString(); } else { Response.Redirect(Globals.NavigateURL(), true); } } else { cmdDelete.Visible = false; ctlAudit.Visible = false; } } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
/// ----------------------------------------------------------------------------- /// <summary> /// cmdDelete_Click runs when the delete button is clicked /// </summary> /// <remarks> /// </remarks> /// <history> /// </history> /// ----------------------------------------------------------------------------- protected void cmdDelete_Click(System.Object sender, System.EventArgs e) { try { //Only attempt to delete the item if it exists already if (!Null.IsNull(ItemId)) { SSMTestUserControlController objSSMTestUserControls = new SSMTestUserControlController(); objSSMTestUserControls.DeleteSSMTestUserControl(ModuleId, ItemId); //refresh cache SynchronizeModule(); } this.Response.Redirect(Globals.NavigateURL(this.TabId), true); } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
/// ----------------------------------------------------------------------------- /// <summary> /// cmdUpdate_Click runs when the update button is clicked /// </summary> /// <remarks> /// </remarks> /// <history> /// </history> /// ----------------------------------------------------------------------------- protected void cmdUpdate_Click(System.Object sender, System.EventArgs e) { try { SSMTestUserControlController objSSMTestUserControls = new SSMTestUserControlController(); SSMTestUserControlInfo objSSMTestUserControl = new SSMTestUserControlInfo(); objSSMTestUserControl.ModuleId = ModuleId; objSSMTestUserControl.ItemId = ItemId; objSSMTestUserControl.Content = txtContent.Text; objSSMTestUserControl.CreatedByUser = this.UserId; //Update the content within the SSMTestUserControl table if (Null.IsNull(ItemId)) { objSSMTestUserControls.AddSSMTestUserControl(objSSMTestUserControl); } else { objSSMTestUserControls.UpdateSSMTestUserControl(objSSMTestUserControl); } //refresh cache SynchronizeModule(); //Redirect back to the portal home page this.Response.Redirect(Globals.NavigateURL(this.TabId), true); } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }