public ActionResult AddSelectedDatasetToBus(string id) { DatasetManager datasetManager = new DatasetManager(); try { ChooseDatasetViewModel model = new ChooseDatasetViewModel(); long datasetId = Convert.ToInt64(id); Dataset dataset = datasetManager.GetDataset(datasetId); DatasetVersion datasetVersion; if (datasetManager.IsDatasetCheckedIn(datasetId)) { addSelectedDatasetToBus(datasetId); } else { model.ErrorList.Add(new Error(ErrorType.Dataset, "Dataset is not checked in.")); } Session["TaskManager"] = TaskManager; //create Model model.StepInfo = TaskManager.Current(); if ((List <ListViewItem>)Session["DatasetVersionViewList"] != null) { model.DatasetsViewList = (List <ListViewItem>)Session["DatasetVersionViewList"]; } if (TaskManager.Bus.ContainsKey(TaskManager.DATASET_TITLE) && TaskManager.Bus[TaskManager.DATASET_TITLE] != null) { model.DatasetTitle = TaskManager.Bus[TaskManager.DATASET_TITLE].ToString(); } model.SelectedDatasetId = Convert.ToInt32(id); return(PartialView("SpecifyDataset", model)); } finally { datasetManager.Dispose(); } }
public ActionResult SpecifyDataset(int index) { TaskManager = (TaskManager)Session["TaskManager"]; //set current stepinfo based on index if (TaskManager != null) { TaskManager.SetCurrent(index); // remove if existing TaskManager.RemoveExecutedStep(TaskManager.Current()); } ChooseDatasetViewModel model = new ChooseDatasetViewModel(); // jump back to this step // check if dataset selected if (TaskManager.Bus.ContainsKey(TaskManager.DATASET_ID)) { long datasetId = Convert.ToInt64(TaskManager.Bus[TaskManager.DATASET_ID]); if (datasetId > 0) { // add title to model if (TaskManager.Bus.ContainsKey(TaskManager.DATASET_TITLE) && TaskManager.Bus[TaskManager.DATASET_TITLE] != null) { model.DatasetTitle = TaskManager.Bus[TaskManager.DATASET_TITLE].ToString(); } // add seleted dataset id to model model.SelectedDatasetId = Convert.ToInt32(TaskManager.Bus[TaskManager.DATASET_ID]); // add informations of dataset to Bus addSelectedDatasetToBus(datasetId); } } model.StepInfo = TaskManager.Current(); if ((List <ListViewItem>)Session["DatasetVersionViewList"] != null) { model.DatasetsViewList = (List <ListViewItem>)Session["DatasetVersionViewList"]; } return(PartialView(model)); }
public ActionResult SpecifyDataset(object[] data) { using (var unitOfWork = this.GetUnitOfWork()) { TaskManager = (TaskManager)Session["TaskManager"]; ChooseDatasetViewModel model = new ChooseDatasetViewModel(); model.StepInfo = TaskManager.Current(); if (TaskManager != null) { TaskManager.Current().SetValid(false); if (TaskManager.Bus.ContainsKey(TaskManager.DATASET_ID)) { Dataset ds = new Dataset(); try { ds = unitOfWork.GetReadOnlyRepository <Dataset>().Get((long)Convert.ToInt32(TaskManager.Bus[TaskManager.DATASET_ID])); TaskManager.AddToBus(TaskManager.DATASTRUCTURE_ID, ((DataStructure)(ds.DataStructure.Self)).Id); TaskManager.AddToBus(TaskManager.DATASTRUCTURE_TITLE, ((DataStructure)(ds.DataStructure.Self)).Name); TaskManager.Current().SetValid(true); } catch { model.ErrorList.Add(new Error(ErrorType.Other, "Dataset not exist.")); } } else { model.ErrorList.Add(new Error(ErrorType.Other, "Dataset not exist.")); } if (TaskManager.Current().valid == true) { TaskManager.AddExecutedStep(TaskManager.Current()); TaskManager.GoToNext(); Session["TaskManager"] = TaskManager; ActionInfo actionInfo = TaskManager.Current().GetActionInfo; return(RedirectToAction(actionInfo.ActionName, actionInfo.ControllerName, new RouteValueDictionary { { "area", actionInfo.AreaName }, { "index", TaskManager.GetCurrentStepInfoIndex() } })); } else { TaskManager.Current().SetStatus(StepStatus.error); //reload model model.StepInfo = TaskManager.Current(); if ((List <ListViewItem>)Session["DatasetVersionViewList"] != null) { model.DatasetsViewList = (List <ListViewItem>)Session["DatasetVersionViewList"]; } } } return(PartialView(model)); } }