public void CreateMultilingualSite()
 {
     AuthenticationHelper.AuthenticateUser(Admin, Password);
     var siteName = ArrangementConfig.GetArrangementSite();
     var siteUrl = ArrangementConfig.GetArrangementSiteUrl();
     var siteCultures = ArrangementConfig.GetArrangementSiteCultures();
     var site = new SiteModel(siteName, siteUrl, siteName + "Provider", true) { Cultures = siteCultures };
     MultisiteHelper.CreateSite(site);
 }
        public void CreateMultilingualSite()
        {
            AuthenticationHelper.AuthenticateUser(Admin, Password);

            var siteCultures = ArrangementConfig.GetArrangementSiteCultures();
            var site = new SiteModel(SiteName, Url, SiteName + "Provider", true) { Cultures = siteCultures, SourcePagesSiteId = Guid.Empty };
            MultisiteHelper.CreateSite(site);

            this.SharePageTemplateWithSite(SetupSitefinityForMultisiteMultilingual.SiteName, SetupSitefinityForMultisiteMultilingual.Cultures[1]);
        }
Ejemplo n.º 3
0
 public ActionResult AddSite(SiteModel model)
 {
     if (ModelState.IsValid)
     {
         var data = LoadSites();
         List <SiteModel> sites = new List <SiteModel>();
         foreach (var row in data)
         {
             sites.Add(new SiteModel
             {
                 SiteNumber = row.SiteNumber,
                 Address    = row.Address,
                 SiteDoctor = row.SiteDoctor
             });
         }
         bool exists = false;
         foreach (var site in sites)
         {
             if (site.SiteNumber == model.SiteNumber)
             {
                 exists = true;
                 break;
             }
         }
         if (exists == false)
         {
             int recordsCreated = CreateSite(model.SiteNumber, model.Address, model.SiteDoctor);
             return(RedirectToAction("ViewSites"));
         }
         else
         {
             model.SiteNumber = model.SiteNumber + 1;
             AddSite(model);
             return(RedirectToAction("ViewSites"));
         }
     }
     else
     {
         return(View());
     }
 }
        /// <summary>
        /// 请求SSH服务器的状态 创建者: xb 创建时间:2018/05/10
        /// </summary>
        /// <param name="site">待请求的站点</param>
        /// <param name="request">请求对象</param>
        public async Task <LogModel> AccessSSHServer(SiteModel site, SSHRequest request)
        {
            if (null != site.Site_address && !("".Equals(site.Site_address)))
            {
                request.IPAddress = site.Site_address;
                // 获取保存的用户验证的信息
                JObject js = (JObject)JsonConvert.DeserializeObject(site.ProtocolIdentification);
                try
                {
                    request.Identification = new SshIdentificationInfo()
                    {
                        Username = js["username"].ToString(), Password = js["password"].ToString()
                    };
                }
                catch (NullReferenceException)
                {
                    request.Identification = new SshIdentificationInfo()
                    {
                        Username = "******", Password = "******"
                    };
                }
                #region 初始化log
                LogModel log = new LogModel
                {
                    Site_id     = site.Id,
                    Create_Time = DateTime.Now
                };
                #endregion
                // 开始请求
                bool result = await request.MakeRequest();

                // 处理请求记录
                CreateLogWithRequestServerResult(log, request);
                // 补充额外添加的判断
                log.Log_Record = request.ProtocolInfo;
                // 更新站点信息
                UpdateSiteStatus(site, log);
                return(log);
            }
            return(null);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Fixed:
        /// </summary>
        public static string DeleteSiteImage(Context context, SiteModel siteModel)
        {
            siteModel.SiteSettings = SiteSettingsUtilities.Get(
                context: context,
                siteModel: siteModel,
                referenceId: siteModel.SiteId);
            var invalid = BinaryValidators.OnDeletingSiteImage(
                context: context,
                ss: siteModel.SiteSettings);

            switch (invalid)
            {
            case Error.Types.None: break;

            default: return(invalid.MessageJson(context: context));
            }
            var error = new BinaryModel(siteModel.SiteId)
                        .DeleteSiteImage(context: context);

            if (error.Has())
            {
                return(error.MessageJson(context: context));
            }
            else
            {
                return(new ResponseCollection()
                       .Html(
                           "#SiteImageIconContainer",
                           new HtmlBuilder().SiteImageIcon(
                               context: context,
                               ss: siteModel.SiteSettings,
                               siteId: siteModel.SiteId))
                       .Html(
                           "#SiteImageSettingsEditor",
                           new HtmlBuilder().SiteImageSettingsEditor(
                               context: context,
                               ss: siteModel.SiteSettings))
                       .Message(Messages.FileDeleteCompleted(context: context))
                       .ToJson());
            }
        }
Ejemplo n.º 6
0
        public void Test_ProjectImmutableDataEventsTests_AllTypesNoDuplicates()
        {
            var siteModel = new SiteModel(Guid.Empty, StorageMutability.Immutable, false);
            var events    = new ProductionEventLists(siteModel, MachineConsts.kNullInternalSiteModelMachineIndex);

            DateTime referenceDate = DateTime.UtcNow;

            events.MachineDesignNameIDStateEvents.PutValueAtDate(referenceDate.AddMinutes(-60), 0);
            events.MachineDesignNameIDStateEvents.PutValueAtDate(referenceDate.AddMinutes(-30), 1);
            Assert.True(2 == events.MachineDesignNameIDStateEvents.Count(), $"List contains {events.MachineDesignNameIDStateEvents.Count()} MachineDesignName events, instead of 2");

            events.GPSAccuracyAndToleranceStateEvents.PutValueAtDate(referenceDate.AddMinutes(-60), new GPSAccuracyAndTolerance(GPSAccuracy.Coarse, 2));
            events.GPSAccuracyAndToleranceStateEvents.PutValueAtDate(referenceDate.AddMinutes(-58), new GPSAccuracyAndTolerance(GPSAccuracy.Medium, 2));
            events.GPSAccuracyAndToleranceStateEvents.PutValueAtDate(referenceDate.AddMinutes(-56), new GPSAccuracyAndTolerance(GPSAccuracy.Coarse, 1));
            Assert.True(3 == events.GPSAccuracyAndToleranceStateEvents.Count(), $"List contains {events.GPSAccuracyAndToleranceStateEvents.Count()} GPSAccuracy events, instead of 3");

            var storageProxy = new StorageProxy_Ignite_Transactional(StorageMutability.Mutable);

            storageProxy.SetImmutableStorageProxy(new StorageProxy_Ignite_Transactional(StorageMutability.Immutable));
            events.SaveMachineEventsToPersistentStore(storageProxy);
        }
        private void AddSiteCommand(object siteToAdd)
        {
            var site = siteToAdd as SiteModel;

            site.SiteId      = count = count + 1;
            site.CreatedDate = DateTime.Now;
            if (string.IsNullOrWhiteSpace(site.SiteName))
            {
                SiteErrorVisibility = Visibility.Visible;
                return;
            }
            if (string.IsNullOrWhiteSpace(site.Address))
            {
                AddressErrorVisibility = Visibility.Visible;
                return;
            }

            _repositoryManager.AddSite(site);
            _sites.Add(site);
            SiteToAdd = new SiteModel();
        }
Ejemplo n.º 8
0
        public static SiteSettings SitesSiteSettings(
            this SiteModel siteModel,
            long referenceId,
            bool setAllChoices      = false,
            bool setSiteIntegration = false)
        {
            var ss = siteModel.SiteSettings ?? new SiteSettings();

            ss.SiteId            = siteModel.SiteId;
            ss.ReferenceId       = referenceId;
            ss.Title             = siteModel.Title.Value;
            ss.ReferenceType     = "Sites";
            ss.ParentId          = siteModel.ParentId;
            ss.InheritPermission = siteModel.InheritPermission;
            ss.AccessStatus      = siteModel.AccessStatus;
            ss.Init();
            ss.SetLinkedSiteSettings();
            ss.SetPermissions(referenceId);
            ss.SetJoinedSsHash();
            return(ss);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Fixed:
        /// </summary>
        public static byte[] SiteImageIcon(Context context, SiteModel siteModel)
        {
            siteModel.SiteSettings = SiteSettingsUtilities.Get(
                context: context,
                siteModel: siteModel,
                referenceId: siteModel.SiteId);
            var invalid = BinaryValidators.OnGetting(
                context: context,
                ss: siteModel.SiteSettings);

            switch (invalid.Type)
            {
            case Error.Types.None: break;

            default: return(null);
            }
            return(new BinaryModel(siteModel.SiteId).SiteImage(
                       context: context,
                       sizeType: Libraries.Images.ImageData.SizeTypes.Icon,
                       column: Rds.BinariesColumn().Icon()));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 更新站点信息
        /// </summary>
        /// <param name="site"></param>
        /// <returns></returns>
        public int UpdateSite(SiteModel site)
        {
            // result = -1 表示异常返回值,执行操作失败
            int result = -1;

            using (SQLiteConnection conn = new SQLiteConnection(new SQLitePlatformWinRT(), DataBaseControlImpl.DBPath))
            {
                try
                {
                    result = conn.Update(site);
                    Debug.WriteLine(string.Format("更新站点{0} 成功!站点当前已经请求{1}次", site.Id, site.Request_count));
                }
                // 若捕获到数据库相关的异常,如未找到此条记录
                catch (SQLite.Net.SQLiteException e)
                {
                    result = -1;
                    DBHelper.InsertErrorLog(e);
                }
            }
            return(result);
        }
Ejemplo n.º 11
0
        public List <SiteModel> AvailableSiteSearch(string campgroundId, string startDate, string departDate)
        {
            List <SiteModel> availableSites = new List <SiteModel>();

            try
            {
                using (SqlConnection conn = new SqlConnection(connectionString))
                {
                    conn.Open();

                    SqlCommand cmd = new SqlCommand(SQL_GetSites, conn);
                    cmd.Parameters.AddWithValue("@campgroundID", campgroundId);
                    cmd.Parameters.AddWithValue("@arrival", startDate);
                    cmd.Parameters.AddWithValue("@departure", departDate);

                    SqlDataReader reader = cmd.ExecuteReader();

                    while (reader.Read())
                    {
                        SiteModel s = new SiteModel();
                        s.SiteId               = Convert.ToInt32(reader["site_id"]);
                        s.CampgroundId         = Convert.ToInt32(reader["campground_id"]);
                        s.SiteNumber           = Convert.ToInt32(reader["site_number"]);
                        s.MaxOccupancy         = Convert.ToInt32(reader["max_occupancy"]);
                        s.HandicapAccessiblity = Convert.ToString(reader["accessible"]);
                        s.MaxRVLength          = Convert.ToInt32(reader["max_rv_length"]);
                        s.Utilities            = Convert.ToString(reader["utilities"]);


                        availableSites.Add(s);
                    }
                }
            }catch (SqlException ex)
            {
                throw;
            }


            return(availableSites);
        }
Ejemplo n.º 12
0
        private async Task <CRUDEnums.ActionResult> UpsertSite(SiteModel site)
        {
            var dbArgs = new DynamicParameters();

            dbArgs.Add("@Id", site.Id);
            dbArgs.Add("@Parent", site.ParentAccountId);
            dbArgs.Add("@Name", site.AccountName);
            using (IDbConnection conn = Connection)
            {
                try
                {
                    conn.Open();
                    var result = await conn.QueryAsync <SiteModel>(cnSites_UPSERT, dbArgs, commandType : CommandType.StoredProcedure);
                }
                catch (Exception ex)
                {
                    _logger.Error(ex.Message);
                    return(CRUDEnums.ActionResult.UnknownError);
                }
                return(CRUDEnums.ActionResult.Success);
            }
        }
        public static SiteSettings WikisSiteSettings(
            this SiteModel siteModel,
            Context context,
            long referenceId,
            bool setSiteIntegration   = false,
            bool setAllChoices        = false,
            Sqls.TableTypes tableType = Sqls.TableTypes.Normal)
        {
            var ss = siteModel.SiteSettings ?? new SiteSettings();

            ss.LockedTableTime   = siteModel.LockedTime;
            ss.LockedTableUser   = siteModel.LockedUser;
            ss.TableType         = tableType;
            ss.SiteId            = siteModel.SiteId;
            ss.ReferenceId       = referenceId;
            ss.Title             = siteModel.Title.Value;
            ss.Body              = siteModel.Body;
            ss.GridGuide         = siteModel.GridGuide;
            ss.EditorGuide       = siteModel.EditorGuide;
            ss.CalendarGuide     = siteModel.CalendarGuide;
            ss.CrosstabGuide     = siteModel.CrosstabGuide;
            ss.GanttGuide        = siteModel.GanttGuide;
            ss.BurnDownGuide     = siteModel.BurnDownGuide;
            ss.TimeSeriesGuide   = siteModel.TimeSeriesGuide;
            ss.KambanGuide       = siteModel.KambanGuide;
            ss.ImageLibGuide     = siteModel.ImageLibGuide;
            ss.ReferenceType     = "Wikis";
            ss.ParentId          = siteModel.ParentId;
            ss.InheritPermission = siteModel.InheritPermission;
            ss.Publish           = siteModel.Publish;
            ss.AccessStatus      = siteModel.AccessStatus;
            ss.ApiCount          = siteModel.ApiCount;
            ss.ApiCountDate      = siteModel.ApiCountDate;
            ss.Init(context: context);
            ss.SetLinkedSiteSettings(context: context);
            ss.SetPermissions(context: context, referenceId: referenceId);
            ss.SetChoiceHash(context: context, all: setAllChoices);
            return(ss);
        }
        public void TestAccessFTPServer()
        {
            FTPRequest request = FTPRequest.Instance;

            request.Identification = new IdentificationInfo()
            {
                Username = "******", Password = "******"
            };
            SiteModel site = new SiteModel()
            {
                Site_address = "47.94.251.85", ProtocolIdentification = ""
            };

            utilObject.AccessFTPServer(site, request);

            // 判断这次请求是否发生
            Assert.IsFalse(string.IsNullOrEmpty(request.ProtocalInfo));
            // 判断这次预计成功的请求是否成功
            Assert.AreEqual(site.Status_code, "1000");
            // 判断站点请求次数是否符合请求逻辑
            Assert.AreEqual(site.Request_count, 1);
        }
Ejemplo n.º 15
0
        public void Test_SiteModel_Serialization_NewModelWithSingleElements()
        {
            var guid      = Guid.NewGuid();
            var siteModel = new SiteModel(guid, StorageMutability.Immutable, 1.23);

            siteModel.SiteModelExtent.SetMaximalCoverage();
            siteModel.Machines.CreateNew("Test Machine", "HardwareID", MachineType.AsphaltCompactor, 0, false, Guid.NewGuid());
            siteModel.Alignments.AddAlignmentDetails(Guid.NewGuid(), DesignDescriptor.Null(), BoundingWorldExtent3D.Null());
            siteModel.Designs.AddDesignDetails(Guid.NewGuid(), DesignDescriptor.Null(), BoundingWorldExtent3D.Null());
            siteModel.SurveyedSurfaces.AddSurveyedSurfaceDetails(Guid.NewGuid(), DesignDescriptor.Null(), DateTime.UtcNow, BoundingWorldExtent3D.Null());

            var metaData = siteModel.MetaData;

            metaData.ID.Should().Be(guid);
            metaData.LastModifiedDate.Should().Be(siteModel.LastModifiedDate);
            metaData.CreationDate.Should().Be(siteModel.CreationDate);
            metaData.AlignmentCount.Should().Be(1);
            metaData.DesignCount.Should().Be(1);
            metaData.SiteModelExtent.Should().BeEquivalentTo(siteModel.SiteModelExtent);
            metaData.MachineCount.Should().Be(1);
            metaData.SurveyedSurfaceCount.Should().Be(1);
        }
Ejemplo n.º 16
0
        private static void Update(SiteModel siteModel, long id, IEnumerable <int> selected = null)
        {
            var hasFormula = siteModel.SiteSettings.Formulas?.Any() ?? false;
            var ss         = SiteSettingsUtilities.Get(siteModel, id);

            switch (siteModel.ReferenceType)
            {
            case "Issues":
                UpdateIssues(ss, siteModel.SiteId, id, selected, hasFormula: hasFormula);
                break;

            case "Results":
                UpdateResults(ss, siteModel.SiteId, id, selected, hasFormula: hasFormula);
                break;

            case "Wikis":
                UpdateWikis(ss, siteModel.SiteId, id, selected, hasFormula: hasFormula);
                break;

            default: break;
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// 请求FTP服务器的状态
        /// </summary>
        /// <param name="site">待请求的站点</param>
        /// <param name="request">请求对象</param>
        public async Task <LogModel> AccessFTPServer(SiteModel site, FTPRequest request)
        {
            if (null != site.Site_address && !("".Equals(site.Site_address)))
            {
                // 检测并赋值DNS服务器IP
                IPAddress ip = await GetIPAddressAsync(site.Site_address);

                // IP 不合法
                if (null == ip)
                {
                    return(null);
                }
                request.FtpServer = IPAddress.Parse(site.Site_address);
                // 获取保存的用户验证的信息
                JObject js = (JObject)JsonConvert.DeserializeObject(site.ProtocolIdentification);
                request.Identification = new IdentificationInfo()
                {
                    Username = js["useaname"].ToString(), Password = js["password"].ToString()
                };
                #region 初始化log
                LogModel log = new LogModel
                {
                    Site_id     = site.Id,
                    Create_time = DateTime.Now
                };
                #endregion
                // 开始请求
                bool result = await request.MakeRequest();

                // 处理请求记录
                CreateLogWithRequestServerResult(log, request);
                // 补充额外添加的判断
                log.Log_record = request.ProtocalInfo;
                // 更新站点信息
                UpdateSiteStatus(site, log);
                return(log);
            }
            return(null);
        }
Ejemplo n.º 18
0
        public void Test_TAGProcessor_ProcessEpochContext_WithValidPosition()
        {
            var SiteModel = new SiteModel(StorageMutability.Immutable);

            SiteModel.IgnoreInvalidPositions = false;

            var Machine = new Machine();
            var SiteModelGridAggregator             = new ServerSubGridTree(SiteModel.ID, StorageMutability.Mutable);
            var MachineTargetValueChangesAggregator = new ProductionEventLists(SiteModel, MachineConsts.kNullInternalSiteModelMachineIndex);

            TAGProcessor processor = new TAGProcessor(SiteModel, Machine, SiteModelGridAggregator, MachineTargetValueChangesAggregator);

            // Set the blade left and right tip locations to a trivial epoch, the epoch and do it again to trigger a swathing scan, then
            // check to see if it generated anything!

            Fence interpolationFence = new Fence();

            interpolationFence.SetRectangleFence(0, 0, 1, 1);

            DateTime StartTime = DateTime.SpecifyKind(new DateTime(2000, 1, 1, 1, 1, 1), DateTimeKind.Utc);

            processor.DataLeft  = new XYZ(0, 0, 5);
            processor.DataRight = new XYZ(1, 0, 5);
            processor.DataTime  = StartTime;

            Assert.True(processor.ProcessEpochContext(), "ProcessEpochContext returned false in default TAGProcessor state (1)");

            DateTime EndTime = DateTime.SpecifyKind(new DateTime(2000, 1, 1, 1, 1, 3), DateTimeKind.Utc);

            processor.DataLeft  = new XYZ(0, 1, 5);
            processor.DataRight = new XYZ(1, 1, 5);
            processor.DataTime  = EndTime;

            Assert.True(processor.ProcessEpochContext(), "ProcessEpochContext returned false in default TAGProcessor state (2)");

            Assert.Equal(9, processor.ProcessedCellPassesCount);

            Assert.Equal(2, processor.ProcessedEpochCount);
        }
        public ActionResult CreateSite(long organizationId)
        {
            var site = new Site
            {
                IsNew = true
            };

            _siteRepository.Insert(site);

            var organization = _organizationRepository.GetById(organizationId);

            organization.Sites.Add(site);

            this._dbContext.SaveChanges();

            var model = new SiteModel();

            model = site.ToModel();
            var html = this.SitePanel(model);

            return(Json(new { Id = site.Id, Html = html }));
        }
Ejemplo n.º 20
0
        public void Test_SiteModel_Creation_WithNonTransientOriginModel_DoNotPreserveMultiple()
        {
            var originSiteModel = new SiteModel(Guid.NewGuid(), TRex.Storage.Models.StorageMutability.Immutable, false);
            var _1  = originSiteModel.Alignments;
            var _2  = originSiteModel.Designs;
            var _3  = originSiteModel.SiteModelDesigns;
            var _4  = originSiteModel.SiteProofingRuns;
            var _5  = originSiteModel.MachinesTargetValues;
            var _6  = originSiteModel.SiteModelMachineDesigns;
            var _7  = originSiteModel.Machines;
            var _8  = originSiteModel.SurveyedSurfaces;
            var _9  = originSiteModel.Machines;
            var _10 = originSiteModel.ExistenceMap;

            var newSiteModel = new SiteModel(originSiteModel, SiteModelOriginConstructionFlags.PreserveNothing);

            newSiteModel.AlignmentsLoaded.Should().Be(false);
            newSiteModel.DesignsLoaded.Should().Be(false);
            newSiteModel.SiteModelDesignsLoaded.Should().Be(false);
            newSiteModel.SiteProofingRunsLoaded.Should().Be(false);
            newSiteModel.MachineTargetValuesLoaded.Should().Be(false);
            newSiteModel.SiteModelMachineDesignsLoaded.Should().Be(false);
            newSiteModel.MachinesLoaded.Should().Be(false);
            newSiteModel.SurveyedSurfacesLoaded.Should().Be(false);
            newSiteModel.MachinesLoaded.Should().Be(false);
            newSiteModel.ExistenceMapLoaded.Should().Be(false);

            newSiteModel.Alignments.Should().NotBeSameAs(originSiteModel.Alignments);
            newSiteModel.Designs.Should().NotBeSameAs(originSiteModel.Designs);
            newSiteModel.SiteModelDesigns.Should().NotBeSameAs(originSiteModel.SiteModelDesigns);
            newSiteModel.SiteProofingRuns.Should().NotBeSameAs(originSiteModel.SiteProofingRuns);
            newSiteModel.MachinesTargetValues.Should().NotBe(originSiteModel.MachinesTargetValues);
            newSiteModel.SiteModelMachineDesigns.Should().NotBeSameAs(originSiteModel.SiteModelMachineDesigns);
            newSiteModel.Machines.Should().NotBeSameAs(originSiteModel.Machines);
            newSiteModel.SurveyedSurfaces.Should().NotBeSameAs(originSiteModel.SurveyedSurfaces);
            newSiteModel.Machines.Should().NotBeSameAs(originSiteModel.Machines);
            newSiteModel.ExistenceMap.Should().NotBe(originSiteModel.ExistenceMap);
        }
Ejemplo n.º 21
0
 public static Site ToEntity(this SiteModel model, Site source = null)
 {
     if (source == null)
     {
         source = new Site
         {
             Id         = source.Id,
             Name       = source.Name,
             Longtitude = source.Longtitude,
             Latitude   = source.Latitude,
             CreateDay  = source.CreateDay,
             UpdateDay  = source.UpdateDay,
             CreateBy   = source.CreateBy,
             UpdateBy   = source.UpdateBy,
             Group_Id   = source.Group_Id,
             IsActive   = source.IsActive,
             Address    = source.Address,
             DeviceId   = source.DeviceId,
             Area_Id    = source.Area_Id,
             TimeZone   = source.TimeZone,
         };
     }
     source.Id         = model.Id;
     source.Name       = model.Name;
     source.Longtitude = model.Longtitude;
     source.Latitude   = model.Latitude;
     source.CreateDay  = model.CreateDay;
     source.UpdateDay  = model.UpdateDay;
     source.UpdateBy   = model.UpdateBy;
     source.CreateBy   = model.CreateBy;
     source.Group_Id   = model.Group_Id;
     source.IsActive   = model.IsActive;
     source.Address    = source.Address;
     source.DeviceId   = source.DeviceId;
     source.Area_Id    = source.Area_Id;
     source.TimeZone   = source.TimeZone;
     return(source);
 }
Ejemplo n.º 22
0
        public ActionResult Create(SiteModel sitemodel)
        {
            if (ModelState.IsValid)
            {
                var id   = Convert.ToInt32(StateManager.GetCurrentUser());
                var site = new Sites()
                {
                    flickr_username   = sitemodel.FlickrUserName,
                    title             = sitemodel.Title,
                    site_type         = sitemodel.SiteType,
                    verification_code = Guid.NewGuid().ToString()
                };

                sitesService.Save(id, sitemodel.Email, site);

                var shortUrl = GenerateSiteShortLink(site.verification_code);

                return(RedirectToAction("CreateSuccess", new RouteValueDictionary
                {
                    {
                        "msg",
                        "El sitio se ha creado satisfactoriamente, accedé ya al mismo:"
                    }
                    ,
                    {
                        "url",
                        shortUrl
                    }
                    ,
                    {
                        "title",
                        site.title
                    }
                }));
            }

            return(View());
        }
        public static SiteSettings Get(
            SiteModel siteModel,
            long referenceId,
            bool setSiteIntegration = false,
            bool setAllChoices      = false)
        {
            switch (siteModel.ReferenceType)
            {
            case "Sites": return(SitesSiteSettings(
                                     siteModel: siteModel,
                                     referenceId: referenceId,
                                     setSiteIntegration: setSiteIntegration,
                                     setAllChoices: setAllChoices));

            case "Issues": return(IssuesSiteSettings(
                                      siteModel: siteModel,
                                      referenceId: referenceId,
                                      setSiteIntegration: setSiteIntegration,
                                      setAllChoices: setAllChoices));

            case "Results": return(ResultsSiteSettings(
                                       siteModel: siteModel,
                                       referenceId: referenceId,
                                       setSiteIntegration: setSiteIntegration,
                                       setAllChoices: setAllChoices));

            case "Wikis": return(WikisSiteSettings(
                                     siteModel: siteModel,
                                     referenceId: referenceId,
                                     setSiteIntegration: setSiteIntegration,
                                     setAllChoices: setAllChoices));

            default: return(new SiteSettings()
                {
                    SiteId = siteModel.SiteId
                });
            }
        }
Ejemplo n.º 24
0
        public ActionResult Site(SiteModel model)
        {
            if (ModelState.IsValid)
            {
                MallConfigInfo mallConfigInfo = BMAConfig.MallConfig;

                mallConfigInfo.MallName       = model.MallName == null ? "" : model.MallName;
                mallConfigInfo.SiteUrl        = model.SiteUrl == null ? "" : model.SiteUrl;
                mallConfigInfo.SiteTitle      = model.SiteTitle == null ? "" : model.SiteTitle;
                mallConfigInfo.SEOKeyword     = model.SEOKeyword == null ? "" : model.SEOKeyword;
                mallConfigInfo.SEODescription = model.SEODescription == null ? "" : model.SEODescription;
                mallConfigInfo.ICP            = model.ICP == null ? "" : model.ICP;
                mallConfigInfo.Script         = model.Script == null ? "" : model.Script;
                mallConfigInfo.IsLicensed     = model.IsLicensed;

                BMAConfig.SaveMallConfig(mallConfigInfo);
                Emails.ResetMall();
                SMSes.ResetMall();
                AddMallAdminLog("修改站点信息");
                return(PromptView(Url.Action("site"), "修改站点信息成功"));
            }
            return(View(model));
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Fixed:
        /// </summary>
        public static string UpdateSiteImage(SiteModel siteModel)
        {
            siteModel.SiteSettings = SiteSettingsUtilities.Get(siteModel, siteModel.SiteId);
            var invalid = BinaryValidators.OnUpdating(siteModel.SiteSettings);

            switch (invalid)
            {
            case Error.Types.None: break;

            default: return(invalid.MessageJson());
            }
            var error = new BinaryModel(siteModel.SiteId).UpdateSiteImage(
                Forms.File(Libraries.Images.ImageData.Types.SiteImage.ToString()));

            if (error.Has())
            {
                return(error.MessageJson());
            }
            else
            {
                return(Messages.ResponseFileUpdateCompleted().ToJson());
            }
        }
Ejemplo n.º 26
0
        public void Test_TAGProcessor_ProcessEpochContext_WithoutValidTimestamp()
        {
            var SiteModel = new SiteModel(StorageMutability.Immutable);

            SiteModel.IgnoreInvalidPositions = false;

            var Machine = new Machine();
            var SiteModelGridAggregator             = new ServerSubGridTree(SiteModel.ID, StorageMutability.Mutable);
            var MachineTargetValueChangesAggregator = new ProductionEventLists(SiteModel, MachineConsts.kNullInternalSiteModelMachineIndex);

            TAGProcessor processor = new TAGProcessor(SiteModel, Machine, SiteModelGridAggregator, MachineTargetValueChangesAggregator);

            // Set the blade left and right tip locations to a trivial epoch, the epoch and do it again to trigger a swathing scan, then
            // check to see if it generated anything!

            Fence interpolationFence = new Fence();

            interpolationFence.SetRectangleFence(0, 0, 1, 1);
            processor.DataLeft  = new XYZ(0, 0, 5);
            processor.DataRight = new XYZ(1, 0, 5);

            Assert.False(processor.ProcessEpochContext(), "ProcessEpochContext returned true without a valid epoch timestamp");
        }
Ejemplo n.º 27
0
        public ActionResult Site(SiteModel model)
        {
            if (ModelState.IsValid)
            {
                ShopConfigInfo shopConfigInfo = BSPConfig.ShopConfig;

                shopConfigInfo.WebName        = model.ShopName == null ? "" : model.ShopName;
                shopConfigInfo.SiteUrl        = model.SiteUrl == null ? "" : model.SiteUrl;
                shopConfigInfo.SiteTitle      = model.SiteTitle == null ? "" : model.SiteTitle;
                shopConfigInfo.SEOKeyword     = model.SEOKeyword == null ? "" : model.SEOKeyword;
                shopConfigInfo.SEODescription = model.SEODescription == null ? "" : model.SEODescription;
                shopConfigInfo.ICP            = model.ICP == null ? "" : model.ICP;
                shopConfigInfo.Script         = model.Script == null ? "" : model.Script;
                shopConfigInfo.IsLicensed     = model.IsLicensed;

                BSPConfig.SaveShopConfig(shopConfigInfo);
                Emails.ResetShop();
                SMSes.ResetShop();
                AddAdminOperateLog("修改站点信息");
                return(PromptView(Url.Action("site"), "修改站点信息成功"));
            }
            return(View(model));
        }
Ejemplo n.º 28
0
        public ActionResult EditSite(string siteName)
        {
            JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();

            var querySite = (from p in _dbContext.T_Sites
                             where p.vSiteName == siteName
                             select p).FirstOrDefault();

            Models.SiteModel model = new SiteModel();
            model._StatesList       = Helper.Helper.GetUSAStates();
            model._CustomerList     = Helper.Helper.GetCustomers();
            model._TechnologyList   = Helper.Helper.GetTechEvolutionCodes();
            model._CrewUserNameList = Helper.Helper.GetCrewUser();

            model.siteName     = querySite.vSiteName;
            model.siteAddress  = querySite.vAddress;
            model.siteCity     = querySite.vCity;
            model.states       = querySite.vStateCode;
            model.customerName = querySite.vCustomerName;
            model.technology   = querySite.vTechEvolutionCodeName;

            return(View(model));
        }
        internal PackagePermissionModel(Context context, SiteModel siteModel, List <long> recordIdList)
        {
            SiteId = siteModel.SiteId;
            recordIdList.Add(SiteId);
            var dataTable = Repository.ExecuteTable(
                context: context,
                statements: Rds.SelectPermissions(
                    column: Rds.PermissionsColumn()
                    .ReferenceId()
                    .DeptId()
                    .GroupId()
                    .UserId()
                    .PermissionType(),
                    where : Rds.PermissionsWhere()
                    .ReferenceId_In(
                        value: recordIdList.Where(o => o != 0),
                        _using: recordIdList.Count() > 0)));

            foreach (DataRow dataRow in dataTable.Rows)
            {
                Permissions.Add(new PermissionShortModel(dataRow));
            }
        }
Ejemplo n.º 30
0
        public ActionResult <GenericValidator> AddSite([FromBody] SiteModel site)
        {
            var gVal = new GenericValidator();

            try
            {
                if (string.IsNullOrEmpty(site.SiteId))
                {
                    gVal.Code    = -1;
                    gVal.Message = "Please provide Site's enrolmentId.";
                    return(gVal);
                }
                if (string.IsNullOrEmpty(site.Name))
                {
                    gVal.Code    = -1;
                    gVal.Message = "Please provide Site's Name.";
                    return(gVal);
                }
                var status = _siteService.AddSite(site);
                if (status < 1)
                {
                    gVal.Code    = -1;
                    gVal.Message = status == -3? "Site record already exists" : "An unknown error was encountered. Please try again.";
                    return(gVal);
                }

                gVal.Code    = status;
                gVal.Message = "Site information was successfully Added";
                return(gVal);
            }
            catch (Exception ex)
            {
                gVal.Code    = -1;
                gVal.Message = ex.Message != null? ex.Message : ex.InnerException != null? ex.InnerException.Message : "An unknown error was encountered. Please try again.";
                return(gVal);
            }
        }
Ejemplo n.º 31
0
        public string db_MdfySite(SiteModel siteModel, string SiteName, string SiteAddress, string SiteHeight, string SiteWidth, string SiteAmount, string SiteImage)
        {
            string output = null;

            SiteImage = FileOperations.CopySiteImage(SiteImage, siteModel.SiteSeqNum);
            if (CustomValidation.validateString(SiteImage))
            {
                return("Failure in copying image");
            }
            object[] parameters = { SiteName, SiteAddress, SiteHeight, SiteWidth, SiteAmount, SiteImage, siteModel.SiteSeqNum };

            int rowsUpdated = dBOpertions.UPDATE(queries.mdfySite, parameters);

            if (rowsUpdated == 1)
            {
                output = Status.SUCC;
            }
            else
            {
                output = Status.ERR;
            }

            return(output);
        }
Ejemplo n.º 32
0
 /// <summary>
 /// Maps the site model to site.
 /// </summary>
 /// <param name="site">The site.</param>
 /// <returns></returns>
 public static void MapSiteModelToExistingSite(SiteModel site, Site siteEntity)
 {
     siteEntity.ParentId            = site.ParentId;
     siteEntity.Description         = site.Description;
     siteEntity.IsToplevel          = site.IsToplevel;
     siteEntity.Status              = site.Status;
     siteEntity.Address             = site.Address;
     siteEntity.Latitude            = site.Latitude;
     siteEntity.Longitude           = site.Longitude;
     siteEntity.SystemType          = site.SystemType;
     siteEntity.TemplateId          = site.TemplateId;
     siteEntity.SitePriority        = site.SitePriority;
     siteEntity.JsonService         = site.JsonService;
     siteEntity.JsonPassword        = site.JsonPassword;
     siteEntity.Ssl                 = site.Ssl;
     siteEntity.JsonUserName        = site.JsonUserName;
     siteEntity.NotificationEnabled = site.NotificationEnabled;
     siteEntity.NotificationName    = site.NotificationName;
     siteEntity.SharedCategories    = site.SharedCategories;
     siteEntity.ControllerType      = site.ControllerType;
     siteEntity.SnmpTemplateId      = site.SnmpTemplateId;
     siteEntity.SnmpDataTemplateId  = site.SnmpDataTemplateId;
     siteEntity.SecurityProtocol    = site.SecurityProtocol;
 }
Ejemplo n.º 33
0
        public ActionResult Site()
        {
            ShopConfigInfo shopConfigInfo = BSPConfig.ShopConfig;

            SiteModel model = new SiteModel();
            model.ShopName = shopConfigInfo.ShopName;
            model.SiteUrl = shopConfigInfo.SiteUrl;
            model.SiteTitle = shopConfigInfo.SiteTitle;
            model.SEOKeyword = shopConfigInfo.SEOKeyword;
            model.SEODescription = shopConfigInfo.SEODescription;
            model.ICP = shopConfigInfo.ICP;
            model.Script = shopConfigInfo.Script;
            model.IsLicensed = shopConfigInfo.IsLicensed;

            return View(model);
        }
Ejemplo n.º 34
0
        public ActionResult Site(SiteModel model)
        {
            if (ModelState.IsValid)
            {
                ShopConfigInfo shopConfigInfo = BSPConfig.ShopConfig;

                shopConfigInfo.ShopName = model.ShopName == null ? "" : model.ShopName;
                shopConfigInfo.SiteUrl = model.SiteUrl == null ? "" : model.SiteUrl;
                shopConfigInfo.SiteTitle = model.SiteTitle == null ? "" : model.SiteTitle;
                shopConfigInfo.SEOKeyword = model.SEOKeyword == null ? "" : model.SEOKeyword;
                shopConfigInfo.SEODescription = model.SEODescription == null ? "" : model.SEODescription;
                shopConfigInfo.ICP = model.ICP == null ? "" : model.ICP;
                shopConfigInfo.Script = model.Script == null ? "" : model.Script;
                shopConfigInfo.IsLicensed = model.IsLicensed;

                BSPConfig.SaveShopConfig(shopConfigInfo);
                Emails.ResetShop();
                SMSes.ResetShop();
                AddAdminOperateLog("修改站点信息");
                return PromptView(Url.Action("site"), "修改站点信息成功");
            }
            return View(model);
        }
Ejemplo n.º 35
0
		/// <summary>
		/// Default constructor.
		/// </summary>
		public EditModel() {
			Cache = new CacheModel();
			Comments = new CommentModel();
			Site = new SiteModel();
			Params = new List<object>();
		}