Exemplo n.º 1
0
        public ActionResult SaveExcelFileInfos(FileInfoModel info)
        {
            TaskManager TaskManager = (TaskManager)Session["TaskManager"];

            ExcelFileReaderInfo excelFileReaderInfo = new ExcelFileReaderInfo();

            excelFileReaderInfo.Data        = info.Data;
            excelFileReaderInfo.Dateformat  = "";//info.Dateformat;
            excelFileReaderInfo.Decimal     = info.Decimal;
            excelFileReaderInfo.Offset      = info.Offset;
            excelFileReaderInfo.Orientation = info.Orientation;
            excelFileReaderInfo.Variables   = info.Variables;

            TaskManager.AddToBus(TaskManager.FILE_READER_INFO, excelFileReaderInfo);

            GetFileInformationModel model = new GetFileInformationModel();

            model.StepInfo                = TaskManager.Current();
            model.Extention               = TaskManager.Bus[TaskManager.EXTENTION].ToString();
            model.FileInfoModel           = info;
            model.FileInfoModel.Extention = TaskManager.Bus[TaskManager.EXTENTION].ToString();
            model.IsSaved = true;

            return(RedirectToAction("ReloadUploadWizard", new { restart = false }));
        }
Exemplo n.º 2
0
        public ActionResult SaveAsciiFileInfos(FileInfoModel info)
        {
            TaskManager TaskManager = (TaskManager)Session["TaskManager"];

            AsciiFileReaderInfo asciiFileReaderInfo = new AsciiFileReaderInfo();

            asciiFileReaderInfo.Data        = info.Data;
            asciiFileReaderInfo.Dateformat  = "";//info.Dateformat;
            asciiFileReaderInfo.Decimal     = info.Decimal;
            asciiFileReaderInfo.Offset      = info.Offset;
            asciiFileReaderInfo.Orientation = info.Orientation;
            asciiFileReaderInfo.Seperator   = info.Separator;
            asciiFileReaderInfo.Variables   = info.Variables;
            asciiFileReaderInfo.TextMarker  = info.TextMarker;

            TaskManager.AddToBus(TaskManager.FILE_READER_INFO, asciiFileReaderInfo);

            GetFileInformationModel model = new GetFileInformationModel();

            model.StepInfo = TaskManager.Current();
            model.StepInfo.SetValid(true);
            model.Extention               = TaskManager.Bus[TaskManager.EXTENTION].ToString();
            model.FileInfoModel           = info;
            model.FileInfoModel.Extention = TaskManager.Bus[TaskManager.EXTENTION].ToString();
            model.IsSaved = true;

            return(RedirectToAction("ReloadUploadWizard", new { restart = false }));
        }
Exemplo n.º 3
0
        public ActionResult GetFileInformation(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());
            }


            //if its a template jumping direkt to the next step
            if (TaskManager.Bus[TaskManager.IS_TEMPLATE].ToString().Equals("true"))
            {
                TaskManager.Current().SetValid(true);
                if (TaskManager.Current().IsValid())
                {
                    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
            {
                GetFileInformationModel model = new GetFileInformationModel();
                model.StepInfo  = TaskManager.Current();
                model.Extention = TaskManager.Bus[TaskManager.EXTENTION].ToString();

                if (TaskManager.Bus.ContainsKey(TaskManager.FILE_READER_INFO))
                {
                    model.FileInfoModel = GetFileInfoModel((AsciiFileReaderInfo)TaskManager.Bus[TaskManager.FILE_READER_INFO], TaskManager.Bus[TaskManager.EXTENTION].ToString());
                }
                else
                {
                    if (model.Extention.Equals(".txt") || model.Extention.Equals(".csv"))
                    {
                        TaskManager.Bus[TaskManager.FILE_READER_INFO] = new AsciiFileReaderInfo();
                    }

                    if (model.Extention.Equals(".xls"))
                    {
                        TaskManager.Bus[TaskManager.FILE_READER_INFO] = new ExcelFileReaderInfo();
                    }
                }

                model.FileInfoModel.Extention = TaskManager.Bus[TaskManager.EXTENTION].ToString();


                return(PartialView(model));
            }

            return(PartialView(new GetFileInformationModel()));
        }
Exemplo n.º 4
0
        public ActionResult GetFileInformation()
        {
            TaskManager = (TaskManager)Session["TaskManager"];
            TaskManager.Current().SetValid(false);

            if (TaskManager.Bus[TaskManager.IS_TEMPLATE].ToString().Equals("true"))
            {
                TaskManager.Current().SetValid(true);
            }

            if (TaskManager.Bus.ContainsKey(TaskManager.FILE_READER_INFO))
            {
                TaskManager.Current().SetValid(true);
            }
            else
            {
                GetFileInformationModel model = new GetFileInformationModel();
                model.StepInfo  = TaskManager.Current();
                model.Extention = TaskManager.Bus[TaskManager.EXTENTION].ToString();
                model.FileInfoModel.Extention = TaskManager.Bus[TaskManager.EXTENTION].ToString();
                model.ErrorList.Add(new Error(ErrorType.Other, "File Infomartion not saved."));

                if (TaskManager.Bus.ContainsKey(TaskManager.FILE_READER_INFO))
                {
                    model.FileInfoModel = GetFileInfoModel((AsciiFileReaderInfo)TaskManager.Bus[TaskManager.FILE_READER_INFO], TaskManager.Bus[TaskManager.EXTENTION].ToString());
                }

                model.FileInfoModel.Extention = TaskManager.Bus[TaskManager.EXTENTION].ToString();

                return(PartialView(model));
            }

            if (TaskManager.Current().IsValid())
            {
                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() }
                }));
            }

            return(PartialView());
        }
        public ActionResult GetFileInformation()
        {
            IOUtility iOUtility = new IOUtility();

            TaskManager = (TaskManager)Session["TaskManager"];
            TaskManager.Current().SetValid(false);

            GetFileInformationModel model = new GetFileInformationModel();

            if (TaskManager.Bus[TaskManager.IS_TEMPLATE].ToString().Equals("true"))
            {
                TaskManager.Current().SetValid(true);
            }

            if (TaskManager.Bus.ContainsKey(TaskManager.FILE_READER_INFO))
            {
                FileReaderInfo fri = (FileReaderInfo)TaskManager.Bus[TaskManager.FILE_READER_INFO];

                if (fri is ExcelFileReaderInfo)
                {
                    ExcelFileReaderInfo efri = (ExcelFileReaderInfo)fri;
                    if (efri.VariablesStartRow == 0)
                    {
                        TaskManager.Current().SetValid(false);
                        model.ErrorList.Add(new Error(ErrorType.Other, "Header is not set."));
                    }

                    if (efri.DataStartRow == 0)
                    {
                        TaskManager.Current().SetValid(false);
                        model.ErrorList.Add(new Error(ErrorType.Other, "Data is not set."));
                    }

                    if (model.ErrorList.Count == 0)
                    {
                        TaskManager.Current().SetValid(true);
                    }
                }
                else
                {
                    TaskManager.Current().SetValid(true);
                }
            }

            if (!TaskManager.Current().IsValid())
            {
                model.StepInfo  = TaskManager.Current();
                model.Extention = TaskManager.Bus[TaskManager.EXTENTION].ToString();
                model.FileInfoModel.Extention = TaskManager.Bus[TaskManager.EXTENTION].ToString();
                model.ErrorList.Add(new Error(ErrorType.Other, "File Information not saved."));

                if (TaskManager.Bus.ContainsKey(TaskManager.FILE_READER_INFO))
                {
                    if (iOUtility.IsSupportedAsciiFile(model.Extention))
                    {
                        model.FileInfoModel = GetFileInfoModel((AsciiFileReaderInfo)TaskManager.Bus[TaskManager.FILE_READER_INFO], TaskManager.Bus[TaskManager.EXTENTION].ToString());
                    }

                    if (iOUtility.IsSupportedExcelFile(model.Extention))
                    {
                        model.FileInfoModel = GetFileInfoModel((ExcelFileReaderInfo)TaskManager.Bus[TaskManager.FILE_READER_INFO], TaskManager.Bus[TaskManager.EXTENTION].ToString());
                    }
                }

                model.FileInfoModel.Extention = TaskManager.Bus[TaskManager.EXTENTION].ToString();

                return(PartialView(model));
            }
            else
            {
                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() }
                }));
            }
        }