Ejemplo n.º 1
0
        public string AddPersonSources(string record, string sources)
        {
            var iModel = new SourceSearch(new Security(new WebUser()));
            string retVal = "";

            try
            {
                iModel.AddSources(record.ParseToGuidList(), sources.ParseToGuidList(),SourceTypes.Person);
            }
            catch (Exception ex1)
            {
                retVal = ex1.Message;
            }

            return WebHelper.MakeReturn(record, retVal);
        }
Ejemplo n.º 2
0
        public string AddSource(string sourceId,
                                   string isCopyHeld,
                                   string isThackrayFound,
                                   string isViewed,
                                   string originalLocation,
                                   string sourceDesc,
                                   string sourceRef,
                                   string sourceNotes,
                                   string sourceDateStr,
                                   string sourceDateStrTo,
                                   string sourceFileCount,
                                   string parishs,
                                   string sourceTypes,
                                   string fileIds)
        {
            string retVal = "";

            var jss = new JavaScriptSerializer();

            var obj = jss.Deserialize<dynamic>(fileIds);

            var tp = new List<ServiceFile>();

            if (obj != null)
                foreach (dynamic item in obj)
                    tp.Add(new ServiceFile(item["url"],item["desc"],item["id"]));

            var ssobj = new SourceDto()
                {
                    IsCopyHeld = isCopyHeld.ToBool(),
                    IsThackrayFound = isThackrayFound.ToBool(),
                    IsViewed = isViewed.ToBool(),
                    OriginalLocation = originalLocation,
                    SourceDateStr = sourceDateStr,
                    SourceDateStrTo = sourceDateStrTo,
                    SourceDesc = sourceDesc,
                    SourceRef = sourceRef,
                    SourceNotes = sourceNotes,
                    SourceFileCount = sourceFileCount.ToInt32(),
                    SourceId = sourceId.ToGuid() ,
                    Files = tp,
                    Parishs = parishs.ParseToGuidList(),
                    SourceTypes = sourceTypes.ParseToIntList()
                };

            var iModel = new SourceSearch(new Security(new WebUser()));

            try
            {
                iModel.Update(ssobj, new SourceValidator(ssobj));

            }

            catch (Exception ex1)
            {
                retVal = ex1.Message;
            }

            return WebHelper.MakeReturn(ssobj.SourceId.ToString(), retVal);
        }
Ejemplo n.º 3
0
        public string RemoveTreeSources(string record)
        {
            string retVal = "";
            var iModel = new SourceSearch(new Security(new WebUser()));

            try
            {
                iModel.RemoveTreeSources(record.ParseToGuidList());
            }
            catch (Exception ex1)
            {
                retVal = ex1.Message;
            }

            return WebHelper.MakeReturn(record, retVal);
        }
Ejemplo n.º 4
0
        public List<string> GetSourceNames(string sourceIds)
        {
            var serviceSourceObject = new ServiceSourceObject();

            var iModel = new SourceSearch(new Security(new WebUser()));

            string retVal = "";
            try
            {
                var ssf = new SourceSearchFilter() { Sources = sourceIds.ParseToGuidList() };
                serviceSourceObject = iModel.Search(SourceSearchTypes.SourceIds, ssf, new DataShaping(){RecordPageSize = 0}, new SourceSearchValidator(ssf));
            }
            catch (Exception ex1)
            {
                retVal = "Exception: " + ex1.Message;
            }
            finally
            {
                if (retVal != "") retVal += Environment.NewLine;

                serviceSourceObject.ErrorStatus = retVal;
            }

            return serviceSourceObject.serviceSources.Select(p => p.SourceRef).ToList();
        }
Ejemplo n.º 5
0
        public ServiceSourceObject GetSources(string sourceTypes, string sourceRef, string sourceDesc, string origLoc,
            string dateLB, string toDateLB, string dateUB, string toDateUB, string fileCount, string isThackrayFound,
            string isCopyHeld, string isViewed, string isChecked, string page_number, string page_size, string sortColumn)
        {
            var serviceSourceObject = new ServiceSourceObject();

            string retVal = "";
            var ssf = new SourceSearchFilter()
                {
                    CensusSources1841 = false,
                    CensusPlaces1841 = false,
                    CopyHeld = isChecked.ToNullableBool() == true ? isCopyHeld.ToNullableBool() : null,
                    ThackrayFound = isChecked.ToNullableBool() == true ? isThackrayFound.ToNullableBool() : null,
                    Viewed = isChecked.ToNullableBool() == true ? isViewed.ToNullableBool() : null,
                    SourceTypes = sourceTypes.ParseToIntList(),
                    Ref = sourceRef,
                    Description = sourceDesc,
                    FromYear= (dateLB.ToInt32() + toDateLB.ToInt32()),
                    ToYear = (toDateUB.ToInt32() + dateUB.ToInt32()),
                    OriginalLocation = origLoc,
                    FileCount = fileCount,
                    UrStart = dateUB.ToInt32(),
                    UrEnd = toDateUB.ToInt32(),
                    LrStart = dateLB.ToInt32(),
                    LrEnd = toDateLB.ToInt32()
                };

            var iModel = new SourceSearch(new Security(new WebUser()));

            try
            {
                serviceSourceObject= iModel.Search(SourceSearchTypes.Standard, ssf, new DataShaping() { RecordStart = page_number.ToInt32(), RecordPageSize = page_size.ToInt32(), Column = sortColumn }, new SourceSearchValidator(ssf));
            }
            catch (Exception ex1)
            {
                retVal = "Exception: " + ex1.Message;
            }
            finally
            {
                if (retVal != "") retVal += Environment.NewLine;

                serviceSourceObject.ErrorStatus = retVal;
            }

            return serviceSourceObject;
        }
Ejemplo n.º 6
0
        public List<CensusSource> Get1841CensusSources(Guid sourceId)
        {
            var serviceSourceObject = new ServiceSourceObject();
            var iModel = new SourceSearch(new Security(new WebUser()));

            string retVal = "";
            try
            {

                var ssf = new SourceSearchFilter() { Sources = new List<Guid>() { sourceId } };
                serviceSourceObject = iModel.Search(SourceSearchTypes.Censussource, ssf,new DataShaping(){RecordPageSize = 0},new SourceSearchValidator(ssf));

            }
            catch (Exception ex1)
            {
                retVal = "Exception: " + ex1.Message;
            }
            finally
            {

                serviceSourceObject.ErrorStatus = retVal;
            }

            return serviceSourceObject.CensusSources;
        }
Ejemplo n.º 7
0
        public SourceAjaxDto GetSource(string sourceId)
        {
            var ssobj = new SourceDto();

            var iModel = new SourceSearch(new Security(new WebUser()));

            string retVal = "";

            try
            {
               ssobj = iModel.Get(new SourceDto(){SourceId = sourceId.ToGuid()});

            }
            catch (Exception ex1)
            {
                retVal = "Exception: " + ex1.Message;
            }
            finally
            {
                if (retVal != "") retVal += Environment.NewLine;
                ssobj.ErrorStatus += retVal;

            }

            return ssobj.ToSourceAjaxDto();
        }
Ejemplo n.º 8
0
        public IHttpActionResult RemoveTreeSources(string record)
        {
            string retVal = "";
            var sourceSearch = new SourceSearch(new Security(new WebUser()));

            try
            {
                sourceSearch.RemoveTreeSources(record.ParseToGuidList());
            }
            catch (Exception ex1)
            {
                retVal = ex1.Message;
            }

            if (retVal != "")
            {
                return Content(HttpStatusCode.BadRequest, retVal);
            }

            return Ok(retVal);
        }
Ejemplo n.º 9
0
        public string DeleteSource(string sourceId)
        {
            var iModel = new SourceSearch(new Security(new WebUser()));

            var retVal = "";
            try
            {

                iModel.DeleteRecords(new SourceSearchFilter() { Sources = sourceId.ParseToGuidList() });

            }
            catch (Exception ex1)
            {
                retVal = "Exception: " + ex1.Message;
            }
            finally
            {
                if (retVal != "") retVal += Environment.NewLine;

            }

            return WebHelper.MakeReturn(sourceId, retVal);
        }
Ejemplo n.º 10
0
        public IHttpActionResult GetSourceNames(string sourceIds)
        {
            var servicesources = new List<string>();

            var sourceSearch = new SourceSearch(new Security(new WebUser()));

            string retVal = "";

            try
            {
                var ssf = new SourceSearchFilter() { Sources = sourceIds.ParseToGuidList() };
                var serviceSourceObject = sourceSearch.Search(SourceSearchTypes.SourceIds, ssf, new DataShaping() { RecordPageSize = 0 }, new SourceSearchValidator(ssf));

                servicesources = serviceSourceObject.serviceSources.Select(p => p.SourceRef).ToList();
            }
            catch (Exception ex1)
            {
                retVal = "Exception: " + ex1.Message;
            }

            if (retVal != "")
            {
                return Content(HttpStatusCode.BadRequest, retVal);
            }

            return Ok(servicesources);
        }
Ejemplo n.º 11
0
        public IHttpActionResult GetSources(string sourceTypes, string sourceRef, string sourceDesc, string origLoc,
            string dateLb, string toDateLb, string dateUb, string toDateUb, string fileCount, string isThackrayFound,
            string isCopyHeld, string isViewed, string isChecked, string pageNumber, string pageSize, string sortColumn)
        {
            ServiceSourceObject serviceSourceObject = new ServiceSourceObject();

            string retVal = "";
            var ssf = new SourceSearchFilter()
            {
                CensusSources1841 = false,
                CensusPlaces1841 = false,
                CopyHeld = isChecked.ToNullableBool() == true ? isCopyHeld.ToNullableBool() : null,
                ThackrayFound = isChecked.ToNullableBool() == true ? isThackrayFound.ToNullableBool() : null,
                Viewed = isChecked.ToNullableBool() == true ? isViewed.ToNullableBool() : null,
                SourceTypes = sourceTypes.ParseToIntList(),
                Ref = sourceRef ?? "",
                Description = sourceDesc ?? "",
                FromYear = (dateLb.ToInt32() + toDateLb.ToInt32()),
                ToYear = (toDateUb.ToInt32() + dateUb.ToInt32()),
                OriginalLocation = origLoc ?? "",
                FileCount = fileCount ?? "",
                UrStart = dateUb.ToInt32(),
                UrEnd = toDateUb.ToInt32(),
                LrStart = dateLb.ToInt32(),
                LrEnd = toDateLb.ToInt32()
            };

            var sourceSearch = new SourceSearch(new Security(new WebUser()));

            try
            {
                serviceSourceObject = sourceSearch.Search(SourceSearchTypes.Standard, ssf, new DataShaping() { RecordStart = pageNumber.ToInt32(), RecordPageSize = pageSize.ToInt32(), Column = sortColumn }, new SourceSearchValidator(ssf));
            }
            catch (Exception ex1)
            {
                retVal = "Exception: " + ex1.Message;
            }

            if (retVal != "")
            {
                return Content(HttpStatusCode.BadRequest, retVal);
            }

            return Ok(serviceSourceObject);
        }
Ejemplo n.º 12
0
        public IHttpActionResult GetSource(string sourceId)
        {
            var ssobj = new SourceDto();

            var sourceSearch = new SourceSearch(new Security(new WebUser()));

            string retVal = "";

            try
            {
                ssobj = sourceSearch.Get(new SourceDto() { SourceId = sourceId.ToGuid() });

            }
            catch (Exception ex1)
            {
                retVal = "Exception: " + ex1.Message;
            }

            if (retVal != "")
            {
                return Content(HttpStatusCode.BadRequest, retVal);
            }

            return Ok(ssobj.ToSourceAjaxDto());
        }
Ejemplo n.º 13
0
        public IHttpActionResult Get1841CensusSources(Guid sourceId)
        {
            var serviceSourceObject = new ServiceSourceObject();
            var sourceSearch = new SourceSearch(new Security(new WebUser()));

            string retVal = "";
            try
            {

                var ssf = new SourceSearchFilter() { Sources = new List<Guid>() { sourceId } };
                serviceSourceObject = sourceSearch.Search(SourceSearchTypes.Censussource, ssf, new DataShaping() { RecordPageSize = 0 }, new SourceSearchValidator(ssf));

            }
            catch (Exception ex1)
            {
                retVal = "Exception: " + ex1.Message;
            }

            if (retVal != "")
            {
                return Content(HttpStatusCode.BadRequest, retVal);
            }

            return Ok(serviceSourceObject.CensusSources);
        }
Ejemplo n.º 14
0
        public IHttpActionResult DeleteSource([FromBody]string sourceId)
        {
            var sourceSearch = new SourceSearch(new Security(new WebUser()));

            var retVal = "";
            try
            {
                sourceSearch.DeleteRecords(new SourceSearchFilter() { Sources = sourceId.ParseToGuidList() });
            }
            catch (Exception ex1)
            {
                retVal = "Exception: " + ex1.Message;
            }

            if (retVal != "")
            {
                return Content(HttpStatusCode.BadRequest, retVal);
            }

            return Ok(true);
        }
Ejemplo n.º 15
0
        public IHttpActionResult AddSource(ServiceSourceAdd serviceSourceAdd)
        {
            string retVal = "";

            var jss = new JavaScriptSerializer();

            var obj = jss.Deserialize<dynamic>(serviceSourceAdd.FileIds?? "");

            var tp = new List<ServiceFile>();

            if (obj != null)
                foreach (dynamic item in obj)
                    tp.Add(new ServiceFile(item["url"], item["desc"], item["id"]));

            var ssobj = new SourceDto()
            {
                IsCopyHeld = serviceSourceAdd.IsCopyHeld.ToBool(),
                IsThackrayFound = serviceSourceAdd.IsThackrayFound.ToBool(),
                IsViewed = serviceSourceAdd.IsViewed.ToBool(),
                OriginalLocation = serviceSourceAdd.OriginalLocation,
                SourceDateStr = serviceSourceAdd.SourceDateStr,
                SourceDateStrTo = serviceSourceAdd.SourceDateStrTo,
                SourceDesc = serviceSourceAdd.SourceDesc,
                SourceRef = serviceSourceAdd.SourceRef,
                SourceNotes = serviceSourceAdd.SourceNotes,
                SourceFileCount = serviceSourceAdd.SourceFileCount.ToInt32(),
                SourceId = serviceSourceAdd.SourceId.ToGuid(),
                Files = tp,
                Parishs = serviceSourceAdd.Parishs.ParseToGuidList(),
                SourceTypes = serviceSourceAdd.SourceTypes.ParseToIntList()
            };

            var sourceSearch = new SourceSearch(new Security(new WebUser()));

            try
            {
                sourceSearch.Update(ssobj, new SourceValidator(ssobj));

            }

            catch (Exception ex1)
            {
                retVal = ex1.Message;
            }

            if (retVal != "")
            {
                return Content(HttpStatusCode.BadRequest, retVal);
            }

            return Ok(ssobj.SourceId.ToString());
        }
Ejemplo n.º 16
0
        public IHttpActionResult AddPersonSources(SourceRecordSourceMap sourceRecordSourceMap)
        {
            var sourceSearch = new SourceSearch(new Security(new WebUser()));
            string retVal = "";

            try
            {
                sourceSearch.AddSources(sourceRecordSourceMap.Records.ParseToGuidList(), sourceRecordSourceMap.Sources.ParseToGuidList(), SourceTypes.Person);
            }
            catch (Exception ex1)
            {
                retVal = ex1.Message;
            }

            if (retVal != "")
            {
                return Content(HttpStatusCode.BadRequest, retVal);
            }

            return Ok(retVal);
        }