public void ExportCsvTestcase(long idtestcase, string header) { Class.TestCase tc = DataAccess.DataAccessTestCase.getTestCase(idtestcase); string attachment = "attachment; " + "filename=LabelTestCase" + string.Format("{0:D4}", idtestcase) + ".csv"; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.ClearHeaders(); HttpContext.Current.Response.ClearContent(); HttpContext.Current.Response.AddHeader("content-disposition", attachment); HttpContext.Current.Response.ContentType = "text/csv"; HttpContext.Current.Response.AddHeader("Pragma", "public"); WriteColumnName(header); List <Class.Lable> listlable = DataAccess.DataAccessTestCase.GetLabelsforIdTestcase(idtestcase); if (!listlable.Any()) { //Class.TestCase tc = DataAccess.DataAccessTestCase.getTestCase(idtestcase); //WriteEmptyInfo(usr,tc.NameTestCase); } else { foreach (Class.Lable lable in listlable) { lable.dbPath = tc.dbPath; WriteLableInfo(lable); } } HttpContext.Current.Response.End(); }
// New test case: send test case notification to eligible users public static List <string> testCaseNotificationMail(Class.User user, Class.TestCase tc) { List <string> message = new List <string>(); // subject: message.Add("New test case " + tc.NameTestCase + " available on labeling framework website"); // message text message.Add("Dear " + user.title + " " + user.Surname + ",<br/><br/> a new test case is available for labeling on: " + "<a href=''" + Constant.webSiteAddress + "''>" + Constant.webSiteAddress + "</a> <br/><br/>Please consider to participate!<br/>Thank you!"); return(message); }
} // complete list of all pages to be viewed with inside nested all images corresponding to that page public manageImg(Class.TestCase tc, Class.User usr) { this.IDTestcase = tc.IDTestcase; this.IDUser = usr.Id_user; this.tc = tc; this.usr = usr; this.iIdxGroup = 0; this.iNGroups = 0; this.iNImages = 0; this.allImages = new List <List <PackageImage> >(); this.currentPageIndex = 1; }
protected void gvTestCase_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) { // get id testcase my datakey selected in the gridview long id_testCase = Convert.ToInt64(gvTestCase.DataKeys[e.NewSelectedIndex].Value); idTestCase.Value = id_testCase.ToString(); gvUser.DataSource = DataAccess.DataAccessTestCase.getUserByIdTestCase(id_testCase); gvUser.DataBind(); Class.TestCase tc = DataAccess.DataAccessTestCase.getTestCase(id_testCase); lTestcase.InnerText = "Testcase: " + tc.NameTestCase; fuser.Visible = true; flable.Visible = false; }
public void ExportCsvUser(long idtestcase, long iduser, string header) { Class.TestCase tc = DataAccess.DataAccessTestCase.getTestCase(idtestcase); string attachment = "attachment; " + "filename=LabelTestCase" + string.Format("{0:D4}", idtestcase) + "_User" + string.Format("{0:D4}", iduser) + ".csv"; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.ClearHeaders(); HttpContext.Current.Response.ClearContent(); HttpContext.Current.Response.AddHeader("content-disposition", attachment); HttpContext.Current.Response.ContentType = "text/csv"; HttpContext.Current.Response.AddHeader("Pragma", "public"); WriteColumnName(header); foreach (Lable lable in DataAccess.DataAccessTestCase.GetLableforIdUserIdTestcase(idtestcase, iduser)) { lable.dbPath = tc.dbPath; WriteLableInfo(lable); } HttpContext.Current.Response.End(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (HttpContext.Current.Session["User"] == null) { Response.Redirect("~/Account/Login.aspx"); } else { long idTestCase = 0; if (HttpContext.Current.Session["IdTestCase"] != null) { idTestCase = Convert.ToInt64(HttpContext.Current.Session["IdTestCase"]); } // infos die immer da sind und sich während des Labelns nicht ändern Class.TestCase tc = DataAccess.DataAccessTestCase.getTestCase().Where(p => p.IDTestcase == idTestCase).FirstOrDefault(); lblNameTestCase.Text = tc.NameTestCase; lblTestQuestion.Text = tc.TestQuestion; lblGeneralInfo.Text = tc.GeneralInfo; if (System.IO.File.Exists(Constant.pathTutorialPages + tc.IDTestcase + ".html")) { string html = System.IO.File.ReadAllText(Constant.pathTutorialPages + tc.IDTestcase + ".html"); hddTutorial.Value = html; disableTutorial.Value = Constant.pathTutorialPages + tc.IDTestcase + ".html"; } else { hddTutorial.Value = ""; disableTutorial.Value = ""; } updateReference(0); HttpContext.Current.Session["viewImage"] = this; if (tc.ActiveLearning) { // check if there are files Class.manageImg managerView = HttpContext.Current.Session["managerView"] as Class.manageImg; // 0: no filesfound; 1: user file found; 2: initial file found int statusFiles = 0; if (System.IO.File.Exists(Constant.pathALuserInput + string.Format("{0:D4}", managerView.IDTestcase) + "_User" + string.Format("{0:D4}", managerView.IDUser) + ".csv")) { statusFiles += 2; HttpContext.Current.Session["numberOfOptimizationsUser"] = int.Parse(System.IO.File.ReadLines(Constant.pathALuserInput + string.Format("{0:D4}", managerView.IDTestcase) + "_User" + string.Format("{0:D4}", managerView.IDUser) + ".csv").First()); } else if (System.IO.File.Exists(Constant.pathALinitialInput + string.Format("{0:D4}", managerView.IDTestcase) + ".csv")) { statusFiles += 1; } HttpContext.Current.Session["statusFiles"] = statusFiles; } } } else { if (HttpContext.Current.Session["User"] == null) { Response.Redirect("~/Account/Login.aspx"); } else { try { bool refresh = (bool)HttpContext.Current.Session["refresh"]; if (refresh) { long idTestCase = 0; if (HttpContext.Current.Session["IdTestCase"] != null) { idTestCase = Convert.ToInt64(HttpContext.Current.Session["IdTestCase"]); } Class.TestCase tc = DataAccess.DataAccessTestCase.getTestCase().Where(p => p.IDTestcase == idTestCase).FirstOrDefault(); Thread task; Class.manageImg managerView; Class.User user = Session["User"] as Class.User; // initialize manage object with all needed content managerView = new manageImg(tc, user); // spawn a thread to create the image packages ThreadStart thread = new ThreadStart(managerView.ThreadRun); task = new Thread(thread); task.Start(); if (task.IsAlive) // creation of everything finished => all necessary information are in Session["managerView"] { Session["managerView"] = managerView; Response.Redirect("~/managementImage/ViewImage_.aspx"); } } }catch (Exception ex) {} } } }