Exemplo n.º 1
0
 private ActionResult RenderIndexView(IEnumerable<TestData> testDataMore, int recordCount, int pageIndex)
 {
     TestDataInfo tdi = new TestDataInfo
     {
         TestDataMore = testDataMore,
         SelectedTestData = new TestData(),
         FindConditionEntity = new FindConditionEntity
         {
             TestCaseId = Nameof<TestData>.Property(td => td.TestCaseId),
             Name = Nameof<TestData>.Property(td => td.Name),
             Value = Nameof<GlobalSetting>.Property(gs => gs.Value) }
     };
     Func<int, UrlHelper, string> pageUrlAccessor = (currentPage, helper) => helper.RouteUrl("TestDataPage", new { PageIndex = currentPage }).ToString();
     ViewResult result = View(tdi);
     ViewBag.RecordCount = recordCount;
     ViewBag.PageIndex = pageIndex;
     ViewBag.PageUrlAccessor = pageUrlAccessor;
     return result;
 }
Exemplo n.º 2
0
 private ActionResult Edit(int tdid,int pageIndex)
 {
     Session["UpdatedId_t"] = tdid;
     if (null != Session["HasQueried_t"])
     {
         FindConditionEntity fce = Session["FindConditionEntity"] as FindConditionEntity;
         string tcid;
         if (null == Session["TestCaseBound"])
             tcid = fce.TestCaseId;
         else
             tcid = Session["TestCaseBound"].ToString();
         TestDataInfo info = new TestDataInfo { FindConditionEntity = new FindConditionEntity { TestCaseId = tcid, Name = fce.Name, Value = fce.Value } };
         return Query(info, pageIndex);
     }
     return RedirectToAction("Index", new { pageIndex = pageIndex });
 }
Exemplo n.º 3
0
 private ActionResult Query(TestDataInfo info, int pageIndex)
 {
     this.TestDataService.CurrentProjectId = (int)Session["PID"];
     int recordCount;
     string tcid;
     if (null == Session["TestCaseBound"])
         tcid = info.FindConditionEntity.TestCaseId;
     else
         tcid = Session["TestCaseBound"].ToString();
     IEnumerable<TestData> testDataMore = this.TestDataService.QueryTestDatas(tcid,
         info.FindConditionEntity.Name, info.FindConditionEntity.Value, pageIndex, PagingInfo.PageSize, out recordCount);
     Session["HasQueried_t"] = true;
     Session["QueriedPageIndex_t"] = pageIndex;
     Session["FindConditionEntity"] = info.FindConditionEntity;
     return RenderIndexView(testDataMore, recordCount, pageIndex);
 }
Exemplo n.º 4
0
 public ActionResult Index(TestDataInfo info, int pageIndex = 1)
 {
     ActionResult ar = VerifyIfProjectSelected("PRJNAME");
     if (null != ar) return ar;
     this.TestDataService.CurrentProjectId = (int)Session["PID"];
     string requestKey = Request.Form.Keys[Request.Form.Keys.Count - 1] as string;
     if (requestKey.Contains(".")) requestKey = requestKey.Substring(0, requestKey.IndexOf("."));
     object pageindex = Session["QueriedPageIndex_t"] ?? pageIndex;
     switch (requestKey)
     {
         case "query":
             return Query(info, 1);
         case "edit":
             return Edit(info.SelectedTestData.Id, (int)pageindex);
         case "delete":
             return Delete(info.SelectedTestData.Id, (int)pageindex);
         case "save":
             return Save(info.SelectedTestData, (int)pageindex);
         default:
             Session["UpdatedId_t"] = null;
             Session["Log_t"] = null;
             return RedirectToAction("Index", new { pageIndex = (int)pageindex });
     }
 }