public void Page_Load(object sender, EventArgs e) { var request = SiteServer.Plugin.Context.AuthenticatedRequest; SiteId = request.GetQueryInt("siteId"); _redirectUrl = request.GetQueryString("redirectUrl"); if (!request.AdminPermissions.HasSitePermissions(SiteId, Utils.PluginId)) { HttpContext.Current.Response.Write("<h1>未授权访问</h1>"); HttpContext.Current.Response.End(); } if (IsPostBack) { return; } var channelInfoList = PublicManager.GetPublicChannelInfoList(SiteId); if (channelInfoList.Count > 0) { HttpContext.Current.Response.Redirect(_redirectUrl); HttpContext.Current.Response.End(); } }
public void Page_Load(object sender, EventArgs e) { if (Request.QueryString["Delete"] != null) { var ruleId = TranslateUtils.ToInt(Request.QueryString["RuleID"]); Main.IdentifierRuleRepository.Delete(ruleId); LtlMessage.Text = Utils.GetMessageHtml("成功删除规则", true); } else if ((Request.QueryString["Up"] != null || Request.QueryString["Down"] != null) && Request.QueryString["RuleID"] != null) { var ruleId = TranslateUtils.ToInt(Request.QueryString["RuleID"]); var isDown = Request.QueryString["Down"] != null; if (isDown) { Main.IdentifierRuleRepository.UpdateTaxisToUp(ruleId, SiteId); } else { Main.IdentifierRuleRepository.UpdateTaxisToDown(ruleId, SiteId); } } if (IsPostBack) { return; } LtlPreview.Text = PublicManager.GetPreviewIdentifier(SiteId); DgContents.DataSource = Main.IdentifierRuleRepository.GetRuleInfoList(SiteId); DgContents.ItemDataBound += DgContents_ItemDataBound; DgContents.DataBind(); BtnAdd.Attributes.Add("onclick", ModalIdentifierRuleAdd.GetOpenWindowStringToAdd(SiteId)); }
public void ContentFormSubmited(int siteId, int channelId, IContentInfo contentInfo, IDictionary <string, object> form) { var categoryChannelId = TranslateUtils.Get <int>(form, "categoryChannelId"); var categoryDepartmentId = TranslateUtils.Get <int>(form, "categoryDepartmentId"); if (categoryChannelId == 0) { throw new Exception("请选择正确的主题分类"); } contentInfo.ChannelId = categoryChannelId; if (categoryDepartmentId == 0) { throw new Exception("请选择正确的机构分类"); } contentInfo.Set(ContentAttribute.DepartmentId, categoryDepartmentId.ToString()); var classInfoList = Main.CategoryClassRepository.GetCategoryClassInfoList(siteId); foreach (var classInfo in classInfoList) { if (classInfo.IsSystem || !classInfo.IsEnabled) { continue; } var attributeName = PublicManager.GetCategoryContentAttributeName(classInfo.ClassCode); var attributeValue = TranslateUtils.Get <int>(form, attributeName); contentInfo.Set(attributeName, attributeValue.ToString()); //if (attributeValue > 0) //{ // CategoryDao.UpdateContentNum(PublishmentSystemInfo, categoryClassInfo.ContentAttributeName, categoryId); //} } if (contentInfo.Id == 0) { var identifier = PublicManager.GetIdentifier(siteId, categoryChannelId, categoryDepartmentId, contentInfo); contentInfo.Set(nameof(ContentAttribute.Identifier), identifier); } else { var effectDate = contentInfo.Get <DateTime>(ContentAttribute.EffectDate); if (string.IsNullOrEmpty(contentInfo.Get <string>(ContentAttribute.Identifier)) || PublicManager.IsIdentifierChanged(siteId, categoryChannelId, categoryDepartmentId, effectDate, contentInfo)) { var identifier = PublicManager.GetIdentifier(siteId, categoryChannelId, categoryDepartmentId, contentInfo); contentInfo.Set(nameof(ContentAttribute.Identifier), identifier); } } }
private void Start() { // Get the user set inputs publicManager = GameObject.Find("PublicManager").GetComponent <PublicManager>(); this.maxSpeed = publicManager.maxSpeed; this.acc = publicManager.acceleration; this.turnSpeed = publicManager.turnSpeed; this.maxTime = publicManager.timeToDeath; // Ignore Collision with other cars rBody = GetComponent <Rigidbody2D>(); Physics.IgnoreLayerCollision(8, 8); sensors = GetComponentsInChildren <Sensor>(); // Sort Checkpoints checkpoints = GameObject.FindGameObjectsWithTag("Checkpoint"); Array.Sort(checkpoints, CompareObNames); }
public ActionResult Public(PublicViewModels model) { // Get all states again var communes = GetAllStates(); // Set these states on the model. We need to do this because // only the selected value from the DropDownList is posted back, not the whole // list of states. model.Communes = GetSelectListItems(communes); // Increment the id Public Random rnd = new Random(); model.IdPublic = rnd.Next(1, 9999); // recovery of the ip address string hote = Dns.GetHostName(); IPHostEntry iphe = Dns.Resolve(hote); string ip = iphe.AddressList[0].ToString(); if (ModelState.IsValid) { Session["PublicViewModels"] = model; Boolean result = true; result = Logs.Logs.ReadLog(model.Email, ip); if (result == true) { PublicManager.GetExtraitPublic(model.IdPublic, model.Name, model.Firstname, model.Email, model.Commune, model.Parcelle); Logs.Logs.LogExtraitPublic(model.IdPublic + " - " + model.Name + " " + model.Firstname + ", Commune de " + model.Commune + " Parcelle n° " + model.Parcelle, model.Email, ip); ViewBag.Success = true; ViewBag.Message = "La demande a été transmise !"; return(RedirectToAction("Done")); } else { TempData["msg"] = "<script>alert('Vous avez atteint le nombre de demandes maximum. Revenez demain.');</script>"; return(View("Public", model)); } } else { ViewBag.Message = "Erreur dans la transmission de la demande !"; return(View("Public", model)); } }
public void CreateIdentifier(int siteId, int parentChannelId, bool isAll) { var channelIdList = Context.ChannelApi.GetChannelIdList(siteId, parentChannelId); channelIdList.Add(parentChannelId); foreach (var channelId in channelIdList) { var contentIdList = Context.ContentApi.GetContentIdList(siteId, channelId); foreach (var contentId in contentIdList) { var contentInfo = Context.ContentApi.GetContentInfo(siteId, channelId, contentId); if (isAll || string.IsNullOrEmpty(contentInfo.Get <string>(ContentAttribute.Identifier))) { var identifier = PublicManager.GetIdentifier(siteId, contentInfo.ChannelId, contentInfo.Get <int>(ContentAttribute.DepartmentId), contentInfo); contentInfo.Set(ContentAttribute.Identifier, identifier); Context.ContentApi.Update(siteId, channelId, contentInfo); } } } }
protected override void OnInit(EventArgs e) { base.OnInit(e); AuthRequest = SiteServer.Plugin.Context.AuthenticatedRequest; SiteId = AuthRequest.GetQueryInt("siteId"); if (!AuthRequest.AdminPermissions.HasSitePermissions(SiteId, Utils.PluginId)) { HttpContext.Current.Response.Write("<h1>未授权访问</h1>"); HttpContext.Current.Response.End(); } ChannelInfoList = PublicManager.GetPublicChannelInfoList(SiteId); if (ChannelInfoList.Count == 0) { HttpContext.Current.Response.Redirect(PageInit.GetRedirectUrl(SiteId, Request.RawUrl)); HttpContext.Current.Response.End(); } }
public string GetCategoriesHtml(int siteId, int channelId, IDictionary <string, object> attributes) { var pairList = new List <KeyValuePair <string, DropDownList> >(); var ddlChannelId = new DropDownList { ID = "categoryChannelId", CssClass = "form-control" }; var channelIdList = Context.ChannelApi.GetChannelIdList(siteId); var nodeCount = channelIdList.Count; var isLastNodeArray = new bool[nodeCount]; foreach (var theChannelId in channelIdList) { var nodeInfo = Context.ChannelApi.GetChannelInfo(siteId, theChannelId); var listItem = new ListItem(Utils.GetSelectOptionText(nodeInfo.ChannelName, nodeInfo.ParentsCount, nodeInfo.LastNode, isLastNodeArray), nodeInfo.Id.ToString()); if (nodeInfo.ContentModelPluginId != Utils.PluginId) { listItem.Value = "0"; listItem.Attributes.Add("disabled", "disabled"); listItem.Attributes.Add("style", "background-color:#f0f0f0;color:#9e9e9e"); } ddlChannelId.Items.Add(listItem); } Utils.SelectSingleItem(ddlChannelId, channelId.ToString()); pairList.Add(new KeyValuePair <string, DropDownList>("主题", ddlChannelId)); var ddlDepartmentId = new DropDownList { ID = "categoryDepartmentId", CssClass = "form-control" }; var departmentIdList = DepartmentManager.GetDepartmentIdList(siteId); foreach (var departmentId in departmentIdList) { var departmentInfo = DepartmentManager.GetDepartmentInfo(siteId, departmentId); var listItem = new ListItem(departmentInfo.DepartmentName, departmentInfo.Id.ToString()); ddlDepartmentId.Items.Add(listItem); } Utils.SelectSingleItem(ddlDepartmentId, TranslateUtils.Get <int>(attributes, ContentAttribute.DepartmentId).ToString()); pairList.Add(new KeyValuePair <string, DropDownList>("机构", ddlDepartmentId)); var classInfoList = Main.CategoryClassRepository.GetCategoryClassInfoList(siteId); foreach (var classInfo in classInfoList) { if (classInfo.IsSystem || !classInfo.IsEnabled) { continue; } var attributeName = PublicManager.GetCategoryContentAttributeName(classInfo.ClassCode); var attributeValue = TranslateUtils.Get <string>(attributes, attributeName); var ddlCategoryId = new DropDownList { ID = attributeName, CssClass = "form-control" }; var categoryIdList = Main.CategoryRepository.GetCategoryIdList(siteId, classInfo.ClassCode); isLastNodeArray = new bool[categoryIdList.Count]; foreach (var categoryId in categoryIdList) { var categoryInfo = Main.CategoryRepository.GetCategoryInfo(categoryId); var listItem = new ListItem(Utils.GetSelectOptionText(categoryInfo.CategoryName, categoryInfo.ParentsCount, categoryInfo.IsLastNode, isLastNodeArray), categoryInfo.Id.ToString()); ddlCategoryId.Items.Add(listItem); } Utils.SelectSingleItem(ddlCategoryId, attributeValue); pairList.Add(new KeyValuePair <string, DropDownList>(classInfo.ClassName, ddlCategoryId)); } var builder = new StringBuilder(); builder.Append(@"<div class=""row"">"); var count = 0; foreach (var keyValuePair in pairList) { if (keyValuePair.Value.Items.Count == 0) { continue; } if (count > 1) { builder.Append(@"</div><div class=""row m-t-10"">"); count = 0; } builder.Append($@" <div class=""col-xs-2 control-label mt-2"">{keyValuePair.Key}分类</div> <div class=""col-xs-4""> {Utils.GetControlRenderHtml(keyValuePair.Value)} </div> "); count++; } builder.Append("</div>"); builder.Append(@"<script> $(document).ready(function () { if ($('#Publisher').val().length == 0) $('#Publisher').val($('#categoryDepartmentId').find('option:selected').text().replace(/[ │└├]/g,'')); $('#categoryDepartmentId').change(function(){ $('#Publisher').val($(this).children('option:selected').text().replace(/[ │└├]/g,'')); }); $('input[type=""radio""][name=""IsAbolition""]').change(function(){ var isAbolition = $('input[type=""radio""][name=""IsAbolition""]:checked').val(); isAbolition == 'True' ? $('#AbolitionDate').parent().parent().show() : $('#AbolitionDate').parent().parent().hide(); }); var isAbolition = $('input[type=""radio""][name=""IsAbolition""]:checked').val(); isAbolition == 'True' ? $('#AbolitionDate').parent().parent().show() : $('#AbolitionDate').parent().parent().hide(); }); </script>"); return(builder.ToString()); }
private void Start() { // get user inputs publicManager = GameObject.Find("PublicManager").GetComponent <PublicManager>(); }
public PublicController() { m_pPublicManager = CoronaShopService.getPublicManager(); m_pSellersManager = CoronaShopService.getSellerManager(); }
private void Start() { EndPoint.gameObject.SetActive(true); pM = GameObject.Find("PublicManager").GetComponent <PublicManager>(); }