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); } }
public ActionResult TestManage(string id, string dataId) { ViewBag.topCompanyId = id; ViewBag.id = dataId; ViewBag.a = dataId.Split('#')[1] + "a"; ViewBag.tableId1 = dataId.Split('#')[1] + "table1"; ViewBag.tableId2 = dataId.Split('#')[1] + "table2"; ViewBag.tableId3 = dataId.Split('#')[1] + "table3"; ViewBag.win01 = dataId.Split('#')[1] + "win01"; ViewBag.win02 = dataId.Split('#')[1] + "win02"; ViewBag.input01 = dataId.Split('#')[1] + "input01"; ViewBag.input02 = dataId.Split('#')[1] + "input02"; ViewBag.input03 = dataId.Split('#')[1] + "input03"; ViewBag.input04 = dataId.Split('#')[1] + "input04"; ViewBag.sub01 = dataId.Split('#')[1] + "sub01"; ViewBag.sub02 = dataId.Split('#')[1] + "sub02"; ViewBag.iframe = dataId.Split('#')[1] + "iframe"; ViewBag.select = dataId.Split('#')[1] + "select"; TestInfoHanding tif = new TestInfoHanding(); ViewBag.hastest = 0; //如果存在id公司的问卷 List <@class> qclasses = new _Class().GetQuestionClass(1, 1000000); string s = "<select style=\"float:left;margin-left:10px;margin-top:6px;\" id=" + ViewBag.select + " class=\"companyclass\" name=\"cars\">"; foreach (@class c in qclasses) { s += "<option class=\"notstart\" value=\"" + c.class_Class + "\">" + c.class_Class + "</option> "; } s += "</select>"; ViewBag.options = s; if (tif.HasTestInfo(id)) { ViewBag.hastest = 1; TestHanding th = new TestHanding(); testInfo t = tif.GetTestInfo(id); ViewBag.testInfoId = t.testInfo_Id; ViewBag.title = t.testInfo_Name; ViewBag.comId = t.testInfo_OwnComPanyId; ViewBag.totalNum = th.GetTestCount(t.testInfo_Id); ViewBag.qclass = th.GetTestClassCount(t.testInfo_Id); ViewBag.creatTime = t.testInfo_GenerateTime; ViewBag.startTime = t.testInfo_StartTime; ViewBag.deadline = t.testInfo_Deadline; } //不存在id公司的问卷 else { ViewBag.title = "未创建"; ViewBag.comId = "未创建"; ViewBag.totalNum = "未创建"; ViewBag.qclass = "未创建"; ViewBag.creatTime = "未创建"; ViewBag.startTime = "未创建"; ViewBag.deadline = "未创建"; } return(PartialView()); }
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); } }