protected void cmdUpdate_Click(object sender, EventArgs e) { try { testController controller = new testController(); testInfo item = new testInfo(); item.Content = txtContent.Text; item.ItemId = itemId; item.ModuleId = this.ModuleId; item.CreatedByUser = this.UserId; //determine if we are adding or updating if (Null.IsNull(item.ItemId)) { controller.Addtest(item); } else { controller.Updatetest(item); } Response.Redirect(Globals.NavigateURL(), true); } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { List <testInfo> items; testController controller = new testController(); items = controller.Gettests(this.ModuleId); //check if we have some content to display, otherwise //display a sample default conent from the resource //settings if (items.Count == 0) { testInfo item = new testInfo(); item.ModuleId = this.ModuleId; item.CreatedByUser = this.UserId; item.Content = Localization.GetString("DefaultContent", LocalResourceFile); items.Add(item); } //bind the data lstContent.DataSource = items; lstContent.DataBind(); } } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }
protected void cmdDelete_Click(object sender, EventArgs e) { try { if (!Null.IsNull(itemId)) { testController controller = new testController(); controller.Deletetest(this.ModuleId, itemId); } } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }
protected void Page_Load(object sender, EventArgs e) { try { if (Request.QueryString["ItemId"] != null) { itemId = Int32.Parse(Request.QueryString["ItemId"]); } if (!IsPostBack) { //load the data into the control the first time //we hit this page cmdDelete.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');"); //check we have an item to lookup if (!Null.IsNull(itemId)) { //load the item testController controller = new testController(); testInfo item = controller.Gettest(this.ModuleId, itemId); if (item != null) { txtContent.Text = item.Content; ctlAudit.CreatedByUser = item.CreatedByUserName; ctlAudit.CreatedDate = item.CreatedDate.ToLongDateString(); } else { Response.Redirect(Globals.NavigateURL(), true); } } else { cmdDelete.Visible = false; ctlAudit.Visible = false; } } } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }