public PolSourceObservationModel PostAddPolSourceObservationDB(PolSourceObservationModel polSourceObservationModel)
        {
            string retStr = PolSourceObservationModelOK(polSourceObservationModel);

            if (!string.IsNullOrEmpty(retStr))
            {
                return(ReturnError(retStr));
            }

            ContactOK contactOK = IsContactOK();

            if (!string.IsNullOrEmpty(contactOK.Error))
            {
                return(ReturnError(contactOK.Error));
            }

            PolSourceSiteService polSourceSiteService = new PolSourceSiteService(LanguageRequest, User);
            PolSourceSiteModel   polSourceSiteModel   = polSourceSiteService.GetPolSourceSiteModelWithPolSourceSiteIDDB(polSourceObservationModel.PolSourceSiteID);

            if (!string.IsNullOrWhiteSpace(polSourceSiteModel.Error))
            {
                return(ReturnError(polSourceSiteModel.Error));
            }

            PolSourceObservation polSourceObservationExist = GetPolSourceObservationExistDB(polSourceObservationModel);

            if (polSourceObservationExist != null)
            {
                return(ReturnError(string.Format(ServiceRes._AlreadyExists, ServiceRes.PolSourceObservation)));
            }

            PolSourceObservation polSourceObservationNew = new PolSourceObservation();

            retStr = FillPolSourceObservation(polSourceObservationNew, polSourceObservationModel, contactOK);
            if (!string.IsNullOrWhiteSpace(retStr))
            {
                return(ReturnError(retStr));
            }

            using (TransactionScope ts = new TransactionScope())
            {
                db.PolSourceObservations.Add(polSourceObservationNew);
                retStr = DoAddChanges();
                if (!string.IsNullOrWhiteSpace(retStr))
                {
                    return(ReturnError(retStr));
                }

                LogModel logModel = _LogService.PostAddLogForObj("PolSourceObservations", polSourceObservationNew.PolSourceObservationID, LogCommandEnum.Add, polSourceObservationNew);
                if (!string.IsNullOrWhiteSpace(logModel.Error))
                {
                    return(ReturnError(logModel.Error));
                }

                ts.Complete();
            }
            return(GetPolSourceObservationModelWithPolSourceObservationIDDB(polSourceObservationNew.PolSourceObservationID));
        }
Esempio n. 2
0
 public KMZService(LanguageEnum LanguageRequest, IPrincipal User)
     : base(LanguageRequest, User)
 {
     _TVItemService         = new TVItemService(LanguageRequest, User);
     _TVItemLinkService     = new TVItemLinkService(LanguageRequest, User);
     _PolSourceSiteService  = new PolSourceSiteService(LanguageRequest, User);
     _InfrastructureService = new InfrastructureService(LanguageRequest, User);
     _MapInfoService        = new MapInfoService(LanguageRequest, User);
     _LogService            = new LogService(LanguageRequest, User);
 }
 public ProvinceToolsService(LanguageEnum LanguageRequest, IPrincipal User)
     : base(LanguageRequest, User)
 {
     _TVItemService                    = new TVItemService(LanguageRequest, User);
     _AppTaskService                   = new AppTaskService(LanguageRequest, User);
     _TVFileService                    = new TVFileService(LanguageRequest, User);
     _MapInfoService                   = new MapInfoService(LanguageRequest, User);
     _PolSourceSiteService             = new PolSourceSiteService(LanguageRequest, User);
     _PolSourceObservationService      = new PolSourceObservationService(LanguageRequest, User);
     _PolSourceObservationIssueService = new PolSourceObservationIssueService(LanguageRequest, User);
 }