Ejemplo n.º 1
0
        public ActionResult SpecificCriteriaPaperShow(FileUploadModelWIthCriteria files)
        {
            List <Object> list = new List <object>();
            Dictionary <string, string> mergedlist = new Dictionary <string, string>();

            foreach (var item in files.File)
            {
                IndividualFileRead aIndividualFileRead = new IndividualFileRead();
                List <DataModel>   listOfAllLines      = new List <DataModel>();

                listOfAllLines = aIndividualFileRead.MethodToIndividualFileRead(item);  //got all data in lines
                if (files.criteriaNo == 1)
                {
                    CriteriaOneClass aCriteriaOneClass = new CriteriaOneClass();
                    list             = aCriteriaOneClass.ExtractFileContent(listOfAllLines);
                    ViewBag.contents = list[0];
                    Dictionary <string, string> contents = new Dictionary <string, string>();
                    //                contents = (Dictionary<string,string>)list[0];
                    foreach (var a in (Dictionary <string, string>)list[0])
                    {
                        mergedlist.Add(a.Key, a.Value);
                    }
                    //                  ViewBag.headings = list[1];
                    foreach (var a in (Dictionary <string, SubHeadingDataModel>)list[1])
                    {
                        mergedlist.Add(a.Key, a.Value.childSubheadingValue);
                    }
//                    ViewBag.subHeadings = list[2];
                    foreach (var a in (Dictionary <string, string>)list[2])
                    {
                        mergedlist.Add(a.Key, a.Value);
                    }
                    ViewBag.list = mergedlist;
                }
                else if (files.criteriaNo == 2)
                {
                    CriteriaTwoClass aCriteriaOneClass = new CriteriaTwoClass();
                    list = aCriteriaOneClass.ExtractFileContent(listOfAllLines);
                    //ViewBag.contents = list[0];
                    foreach (var a in (Dictionary <string, string>)list[0])
                    {
                        mergedlist.Add(a.Key, a.Value);
                    }
                    //ViewBag.subHeadings = list[1];
                    foreach (var a in (Dictionary <string, SubHeadingDataModel>)list[1])
                    {
                        mergedlist.Add(a.Key, a.Value.childSubheadingValue);
                    }
                    //ViewBag.headings = list[2];
                    foreach (var a in (Dictionary <string, string>)list[2])
                    {
                        mergedlist.Add(a.Key, a.Value);
                    }
                    ViewBag.list = mergedlist;
                }
                else if (files.criteriaNo == 3)
                {
                    CriteriaThreeClass aCriteriaThreeClass = new CriteriaThreeClass();
                    list             = aCriteriaThreeClass.ExtractFileContent(listOfAllLines);
                    ViewBag.contents = list[0];
                    foreach (var a in (Dictionary <string, string>)list[0])
                    {
                        mergedlist.Add(a.Key, a.Value);
                    }
                    ViewBag.subHeadings_portions_SeparateHeadings = list[1];
                    foreach (var a in (Dictionary <string, SubHeadingDataModel>)list[1])
                    {
                        mergedlist.Add(a.Key, a.Value.childSubheadingValue);
                    }
                    ViewBag.subHeadings_portions = list[2];
                    foreach (var a in (Dictionary <string, SubHeadingDataModel>)list[2])
                    {
                        mergedlist.Add(a.Key, a.Value.childSubheadingValue);
                    }
                    ViewBag.subHeadings = list[3];
                    foreach (var a in (Dictionary <string, SubHeadingDataModel>)list[3])
                    {
                        mergedlist.Add(a.Key, a.Value.childSubheadingValue);
                    }
                    ViewBag.headings = list[4];
                    foreach (var a in (Dictionary <string, string>)list[4])
                    {
                        mergedlist.Add(a.Key, a.Value);
                    }
                    ViewBag.list = mergedlist;
                }
            }
            return(View());
        }
Ejemplo n.º 2
0
        public ActionResult GetUploadedPdfFiles(FileUploadModel files)
        {
            List <ArticleModel>    aArticleModelList    = new List <ArticleModel>();
            List <UploadDataModel> aUploadDataModelList = new List <UploadDataModel>();

            foreach (var item in files.File)
            {
                IndividualFileRead aIndividualFileRead = new IndividualFileRead();
                List <DataModel>   listOfAllLines      = new List <DataModel>();
                listOfAllLines = aIndividualFileRead.MethodToIndividualFileRead(item);  //got all data in lines
                ExtractionOfCharacteristics aExtractionOfCharacteristics = new ExtractionOfCharacteristics();



                ArticleModel aArticleModel = new ArticleModel();
                aArticleModel = aExtractionOfCharacteristics.Method(listOfAllLines);//got the data in form of ArticleModel(title,list)
                aArticleModelList.Add(aArticleModel);
                //25/04/2018
                //database portion
                UploadDataModel aUploadDataModel = new UploadDataModel();
                aUploadDataModel.artitleTitle = aArticleModel.articleTitle;

                // portion starts for uploading in the database
                ArrayListUpload aArrayListUpload = new ArrayListUpload();

                int titleId = aArrayListUpload.TitleUploadMethod(aArticleModel);
                if (titleId == (-1))
                {
                    //isAlreadyExists
                    aUploadDataModel.uploadProcessMessage = "Article data is already existed";//"Title is already exists";
                }
                else if (titleId == (-2))
                {
                    //notSavedSuccessfully
                    aUploadDataModel.uploadProcessMessage = "Not saved successfully";
                }
                else if (titleId == 0)
                {
                    //noExecutionHappened
                    aUploadDataModel.uploadProcessMessage = "no execution happened, try again";
                }
                else
                {
                    //saveRestDataWithID
                    int articleSavedresult = aArrayListUpload.ArticleDataUploadMethod(titleId, aArticleModel.articleSeparateParagraphs);
                    if (articleSavedresult == -3 || articleSavedresult == 0)
                    {
                        aUploadDataModel.uploadProcessMessage = "Article data not saved successfully";
                    }
                    else
                    {
                        aUploadDataModel.uploadProcessMessage = "Article data saved successfully";
                    }
                }
                aUploadDataModelList.Add(aUploadDataModel);
            }


            TempData["list"] = aUploadDataModelList;
            return(RedirectToAction("GetAllUploadedTitlesResults", "Home" /*new { ListOfUploadedTitles=aUploadDataModelList }*/));
        }