public async Task Delete(string id) { RewriteId rewriteId = new RewriteId(id); Context.Response.StatusCode = (int)HttpStatusCode.NoContent; Site site = (rewriteId.SiteId != null) ? SiteHelper.GetSite(rewriteId.SiteId.Value) : null; var featureManager = new UrlRewriteFeatureManager(); // When target is webserver, uninstall if (rewriteId.SiteId == null && featureManager.IsInstalled()) { if (Os.IsNanoServer) { throw new ApiNotAllowedException("Action not supported on current platform", null); } await featureManager.Uninstall(); } }
public object Get(string id) { EntryId entryId = new EntryId(id); Site site = entryId.SiteId == null ? null : SiteHelper.GetSite(entryId.SiteId.Value); Module module = null; // Get the enabled modules List <Module> modules = ModuleHelper.GetModules(site, entryId.Path); module = modules.FirstOrDefault(m => m.Name.Equals(entryId.Name)); // Module id did not specify an enabled module if (module == null) { return(new StatusCodeResult((int)HttpStatusCode.NotFound)); } return(ModuleHelper.ModuleToJsonModel(module, site, entryId.Path)); }
public object Get() { string globalRulesId = Context.Request.Query[Defines.IDENTIFIER]; if (string.IsNullOrEmpty(globalRulesId)) { return(NotFound()); } var sectionId = new RewriteId(globalRulesId); Site site = sectionId.SiteId == null ? null : SiteHelper.GetSite(sectionId.SiteId.Value); InboundRuleCollection rules = GlobalRulesHelper.GetSection(site, sectionId.Path).InboundRules; this.Context.Response.SetItemsCount(rules.Count()); return(new { rules = rules.Select(rule => GlobalRulesHelper.RuleToJsonModelRef((InboundRule)rule, site, sectionId.Path, Context.Request.GetFields())) }); }
public object Get(string id) { RuleId ruleId = new RuleId(id); Site site = ruleId.SiteId == null ? null : SiteHelper.GetSite(ruleId.SiteId.Value); if (ruleId.SiteId != null && site == null) { // The rule id specified a site but we couldn't find it, therefore we can't get the rule return(NotFound()); } Rule rule = IPRestrictionsHelper.GetRules(site, ruleId.Path).Where(r => r.IpAddress.ToString().Equals(ruleId.IpAddress)).FirstOrDefault(); if (rule == null) { return(NotFound()); } return(IPRestrictionsHelper.RuleToJsonModel(rule, site, ruleId.Path)); }
public static void ResolveRewrite(HttpContext context, out Site site, out string path) { site = null; path = null; string rewriteUuid = null; site = ApplicationHelper.ResolveSite(); path = ApplicationHelper.ResolvePath(); if (path == null) { rewriteUuid = context.Request.Query[Defines.IDENTIFIER]; } if (!string.IsNullOrEmpty(rewriteUuid)) { var rewriteId = new RewriteId(rewriteUuid); site = rewriteId.SiteId == null ? null : SiteHelper.GetSite(rewriteId.SiteId.Value); path = rewriteId.Path; } }
public string Execute(Hashtable params_ht) { Hashtable res = params_ht; if (res["UID"] == null || res["UID"].ToString().Trim().Length <= 0 || res["OrderPayID"] == null || res["OrderPayID"].ToString().Trim().Length <= 0) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "参数不完整")); } else { uid = res["UID"].ToString().Trim(); order_payid = res["OrderPayID"].ToString().Trim(); AlipayOrderQuery orderQuery = new AlipayOrderQuery(); //OrderQueryResult queryResult = orderQuery.Query(order_payid); OrderQueryResult queryResult = orderQuery.QueryByTradeNO(order_payid); string result = JsonConvert.SerializeObject(queryResult); return(result); } }
private static async Task <DialogTurnResult> HowToStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { var userProfile = (UserProfile)stepContext.Values[UserInfo]; var selectedNavOption = stepContext.Context.Activity.Text?.Trim(); if (!string.IsNullOrWhiteSpace(selectedNavOption) && selectedNavOption.Equals("Show How To", StringComparison.InvariantCultureIgnoreCase)) { //send how to items var actions = await SiteHelper.GetHowToActionsAsync(SiteUrl, userProfile.IsMember); await stepContext.Context.SendActivityAsync(actions, cancellationToken); } else { var text = MessageFactory.Text("This selection has NOT been developed yet."); await stepContext.Context.SendActivityAsync(text, cancellationToken); } return(await stepContext.EndDialogAsync(cancellationToken : cancellationToken)); }
protected virtual ActionResult CreateSite([Bind(Exclude = "Parent")] Site site, string parent, string template) { var data = new JsonResultData(ViewData.ModelState); if (ModelState.IsValid) { data.RunWithTry((resultData) => { Site parentSite = null; if (!string.IsNullOrEmpty(parent)) { parentSite = new Site(SiteHelper.SplitFullName(parent)); } var createdSite = Kooboo.CMS.Sites.Services.ServiceFactory.SiteManager.Create(parentSite, site.Name, template, site, User.Identity.Name); resultData.RedirectUrl = Url.Action("SiteMap", new { controller = "Home", siteName = createdSite.FullName }); }); } return(Json(data)); }
public IEnumerable <MenuItem> GetItems(string areaName, ControllerContext controllerContext) { var siteName = controllerContext.RequestContext.GetRequestValue("siteName"); if (!string.IsNullOrEmpty(siteName)) { var site = SiteHelper.Parse(siteName).AsActual(); if (site != null) { var repository = site.GetRepository(); if (repository != null) { areaName = "Contents"; var items = MenuFactory.BuildMenu(controllerContext, areaName, false).Items; ResetRouteValues(siteName, repository.Name, areaName, items); return(items); } } } return(new MenuItem[0]); }
public async Task Delete(string id) { DefaultDocumentId docId = new DefaultDocumentId(id); Context.Response.StatusCode = (int)HttpStatusCode.NoContent; Site site = (docId.SiteId != null) ? SiteHelper.GetSite(docId.SiteId.Value) : null; if (site != null) { var section = DefaultDocumentHelper.GetDefaultDocumentSection(site, docId.Path, ManagementUnit.ResolveConfigScope()); section.RevertToParent(); ManagementUnit.Current.Commit(); } // When target is webserver, uninstall if (docId.SiteId == null && DefaultDocumentHelper.IsFeatureEnabled()) { await DefaultDocumentHelper.SetFeatureEnabled(false); } }
public object Get(string id) { FileId fileId = new FileId(id); Site site = SiteHelper.GetSite(fileId.SiteId); if (site == null) { return(NotFound()); } var physicalPath = FilesHelper.GetPhysicalPath(site, fileId.Path); if (!_fileProvider.GetFile(physicalPath).Exists&& !_fileProvider.GetDirectory(physicalPath).Exists) { return(NotFound()); } var fields = Context.Request.GetFields(); return(_filesHelper.ToJsonModel(site, fileId.Path, fields)); }
public object Get(string id) { RuleId ruleId = new RuleId(id); Site site = ruleId.SiteId == null ? null : SiteHelper.GetSite(ruleId.SiteId.Value); if (ruleId.SiteId != null && site == null) { // The rule id specified a site but we couldn't find it, therefore we can't get the rule return(NotFound()); } Rule rule = RulesHelper.GetRules(site, ruleId.Path).Where(r => r.Name.ToString().Equals(ruleId.Name)).FirstOrDefault(); if (rule == null) { return(NotFound()); } return(RulesHelper.ToJsonModel(rule, site, ruleId.Path, Context.Request.GetFields(), true)); }
public void Delete(string id) { ModulesId modulesId = new ModulesId(id); Context.Response.StatusCode = (int)HttpStatusCode.NoContent; Site site = (modulesId.SiteId != null) ? SiteHelper.GetSite(modulesId.SiteId.Value) : null; if (site == null) { return; } ModuleHelper.EnsureValidScope(site, modulesId.Path); ModulesSection section = ModuleHelper.GetModulesSection(site, modulesId.Path, ManagementUnit.ResolveConfigScope()); section.RevertToParent(); ManagementUnit.Current.Commit(); }
public object Get() { string rewriteMapsId = Context.Request.Query[Defines.IDENTIFIER]; if (string.IsNullOrEmpty(rewriteMapsId)) { return(NotFound()); } var sectionId = new RewriteId(rewriteMapsId); Site site = sectionId.SiteId == null ? null : SiteHelper.GetSite(sectionId.SiteId.Value); RewriteMapCollection maps = RewriteMapsHelper.GetSection(site, sectionId.Path).RewriteMaps; this.Context.Response.SetItemsCount(maps.Count()); return(new { entries = maps.Select(map => RewriteMapsHelper.MapToJsonModelRef(map, site, sectionId.Path, Context.Request.GetFields())) }); }
public async Task FillFieldsFromGetting(JToken record) { JToken tid = record.SelectToken("id"); ID = tid != null ? (tid.Value <string>() ?? string.Empty) : string.Empty; JToken ttitle = record.SelectToken("snippet.title"); Title = ttitle != null ? (ttitle.Value <string>() ?? string.Empty) : string.Empty; JToken desc = record.SelectToken("snippet.description"); SubTitle = desc != null ? (desc.Value <string>() ?? string.Empty) : string.Empty; JToken link = record.SelectToken("snippet.thumbnails.default.url"); if (link != null) { Thumbnail = await SiteHelper.GetStreamFromUrl(link.Value <string>()).ConfigureAwait(false); } }
public async Task FillFieldsFromSingle(JObject record) { JToken ttitle = record.SelectToken("items[0].snippet.title"); Title = ttitle != null ? (ttitle.Value <string>() ?? string.Empty) : string.Empty; JToken sum = record.SelectToken("items[0].snippet.description"); SubTitle = sum != null ? (sum.Value <string>() ?? string.Empty) : string.Empty; JToken tpid = record.SelectToken("items[0].snippet.channelId"); ChannelID = tpid != null?tpid.Value <string>() ?? string.Empty : string.Empty; JToken link = record.SelectToken("items[0].snippet.thumbnails.default.url"); if (link != null) { Thumbnail = await SiteHelper.GetStreamFromUrl(link.Value <string>()).ConfigureAwait(false); } }
public object Patch(string id, [FromBody] dynamic model) { HttpResponseHeadersId headerId = new HttpResponseHeadersId(id); Site site = headerId.SiteId == null ? null : SiteHelper.GetSite(headerId.SiteId.Value); if (headerId.SiteId != null && site == null) { return(new StatusCodeResult((int)HttpStatusCode.NotFound)); } // Check for config_scope string configScope = ManagementUnit.ResolveConfigScope(model);; HttpProtocolSection section = HttpResponseHeadersHelper.GetSection(site, headerId.Path, configScope); HttpResponseHeadersHelper.UpdateFeatureSettings(model, section); ManagementUnit.Current.Commit(); return(HttpResponseHeadersHelper.ToJsonModel(site, headerId.Path)); }
public object Patch(string id, [FromBody] dynamic model) { StaticContentId staticContentId = new StaticContentId(id); Site site = staticContentId.SiteId == null ? null : SiteHelper.GetSite(staticContentId.SiteId.Value); if (staticContentId.SiteId != null && site == null) { return(NotFound()); } // Check for config_scope string configPath = model == null ? null : ManagementUnit.ResolveConfigScope(model);; StaticContentSection section = StaticContentHelper.GetSection(site, staticContentId.Path, configPath); StaticContentHelper.UpdateFeatureSettings(model, section); ManagementUnit.Current.Commit(); return(StaticContentHelper.ToJsonModel(site, staticContentId.Path)); }
private async Task FillData() { if (string.IsNullOrEmpty(item.Description)) { await item.FillDescriptionAsync().ConfigureAwait(false); } Description = item.Description; string link = null; if (item is YouTubeItem) { link = $"http://img.youtube.com/vi/{item.ID}/0.jpg"; } if (link != null) { LargeThumb = await SiteHelper.GetStreamFromUrl(link).ConfigureAwait(false); } }
protected void Page_Load(object sender, EventArgs e) { SiteHelper.CheckLogin(); SiteHelper.GetPageUrlpower("Storage/ProductStock.aspx"); if (Session["PowerRead"].ToString() != "1") { //SiteHelper.NOPowerMessage(); } if (!IsPostBack) { if (Session["warehouse_id"] == null) { //SiteHelper.NOPowerMessage(); // return; JSHelper.WriteScript("alert('请重新登录');top.location.href='/';"); Response.End(); } ConfirmFlag.Text = "0"; LoadData(1, getwhere()); } }
public async Task <object> Get(string id) { TraceId traceId = new TraceId(id); Site site = SiteHelper.GetSite(traceId.SiteId); if (site == null) { return(NotFound()); } var helper = new TracesHelper(_provider, site); TraceInfo trace = await helper.GetTrace(traceId.Name); if (trace == null) { return(NotFound()); } return(helper.ToJsonModel(trace, Context.Request.GetFields())); }
public object Patch([FromBody] dynamic model, string id) { FileId fileId = new FileId(id); Site site = fileId.SiteId == null ? null : SiteHelper.GetSite(fileId.SiteId.Value); if (fileId.SiteId != null && site == null) { // The file id specified a site but we couldn't find it, // therefore we can't get the file return(NotFound()); } File file = FilesHelper.GetFiles(site, fileId.Path).Where(f => f.Name.Equals(fileId.Name)).FirstOrDefault(); if (file == null) { return(NotFound()); } if (model == null) { throw new ApiArgumentException("model"); } var section = DefaultDocumentHelper.GetDefaultDocumentSection(site, fileId.Path, ManagementUnit.ResolveConfigScope(model)); FilesHelper.UpdateFile(file, model, section); ManagementUnit.Current.Commit(); dynamic fle = FilesHelper.ToJsonModel(file, site, fileId.Path); if (fle.id != id) { return(LocationChanged(FilesHelper.GetLocation(fle.id), fle)); } return(fle); }
protected void Page_Load(object sender, EventArgs e) { SiteHelper.CheckLogin(); SiteHelper.GetPageUrlpower("Complaint/addComplaint.aspx"); if (Session["PowerRead"].ToString() != "1") { SiteHelper.NOPowerMessage(); } Id = Request["id"]; if (!Id.IsNumber()) { Id = "0"; } if (!IsPostBack) { SiteHelper.bindReason(ddtypeId); ddtypeId.Items.Insert(0, new ListItem("请选择原因", "0")); SqlHelper sp = LocalSqlHelper.WH; string sql = "select * from Tb_Complaint where id=" + Id; DataTable gdDt = sp.ExecDataTable(sql); if (gdDt.Rows.Count > 0) //修改时 { txtUserId.Text = gdDt.Rows[0]["UserId"].ToString(); txtuserTel.Text = gdDt.Rows[0]["userTel"].ToString(); txtComplaintTime.Text = gdDt.Rows[0]["ComplaintTime"].ToString(); txtComplaintDetail.Text = gdDt.Rows[0]["ComplaintDetail"].ToString(); txtaddOperator.Text = gdDt.Rows[0]["addOperator"].ToString(); ddtypeId.SelectedValue = gdDt.Rows[0]["typeId"].ToString(); fromUrl.Value = Request.ServerVariables["HTTP_REFERER"]; } else { txtaddOperator.Text = HttpContext.Current.Session["LoginName"].ToString(); txtComplaintTime.Text = DateTime.Now.ToString(); } txtaddOperator.Attributes.Add("onchange", "checkLoginId(this.value);"); } }
public static object ToJsonModel(Site site, string path, Fields fields = null, bool full = true) { if (fields == null) { fields = Fields.All; } dynamic obj = new ExpandoObject(); RewriteId rewriteId = new RewriteId(site?.Id, path); // // id if (fields.Exists("id")) { obj.id = rewriteId.Uuid; } // // scope if (fields.Exists("scope")) { obj.scope = site == null ? string.Empty : site.Name + path; } // // version if (fields.Exists("version")) { obj.version = new UrlRewriteFeatureManager().GetVersion()?.ToString(); } // // website if (fields.Exists("website")) { obj.website = SiteHelper.ToJsonModelRef(site); } return(Core.Environment.Hal.Apply(Defines.Resource.Guid, obj, full)); }
public object Patch(string id, [FromBody] dynamic model) { EntryId entryId = new EntryId(id); Site site = entryId.SiteId == null ? null : SiteHelper.GetSite(entryId.SiteId.Value); if (entryId.SiteId != null && site == null) { Context.Response.StatusCode = (int)HttpStatusCode.NotFound; return(null); } ModuleHelper.EnsureValidScope(site, entryId.Path); // Get the enabled modules string configPath = ManagementUnit.ResolveConfigScope(model); List <Module> modules = ModuleHelper.GetModules(site, entryId.Path, configPath); Module module = modules.FirstOrDefault(m => m.Name.Equals(entryId.Name)); if (module == null) { return(NotFound()); } ModuleHelper.UpdateModule(module, model, site); ManagementUnit.Current.Commit(); // // Create response dynamic entry = (dynamic)ModuleHelper.ModuleToJsonModel(module, site, entryId.Path); if (entry.id != id) { return(LocationChanged(ModuleHelper.GetModuleEntryLocation(entry.id), entry)); } return(entry); }
//支付宝 private string AliPay(string uid, decimal money) { UserFinancialManager ufm = new UserFinancialManager(); Hashtable hashuf = new Hashtable(); hashuf["ID"] = CommonHelper.GetGuid; hashuf["UserID"] = uid; hashuf["OrderNum"] = SiteHelper.GenerateOrderNum(); hashuf["OrderPayID"] = SiteHelper.GeneratePayID(); hashuf["ChangesAmount"] = money; hashuf["ChangesTime"] = SiteHelper.GetWebServerCurrentTime(); hashuf["ChangesType"] = (int)UserFinancialChangesType.Recharge; hashuf["Remark"] = "用户充值"; hashuf["Operator"] = uid; hashuf["OperatorType"] = (int)UserFinancialOperatorType.User; hashuf["OperatorWay"] = (int)UserFinancialOperatorWay.Alipay; hashuf["State"] = (int)UserFinancialState.NewSubmit; bool isSuccess = ufm.AddOrEditUserFinancialInfo(hashuf, null); if (isSuccess) { Hashtable uf = ufm.GetUserFinancialPayInfoByPayID(hashuf["OrderPayID"].ToString()); if (uf == null) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "生成支付订单失败")); } else { Hashtable result = new Hashtable(); result["PayWay"] = payway; result["orderInfo"] = YR.Web.api.app.pay.alipay.Core.GetOrderInfo(hashuf["OrderPayID"].ToString(), "余额充值", string.Format("用户充值{0:N2}元", money), alipayNotifyUrl, money); Logger.Info("RechargePay,AliPay orderInfo:" + result["orderInfo"]); return(SiteHelper.GetJsonFromHashTable(result, "success", "生成支付订单成功", "RechargePay")); } } else { return(SiteHelper.GetJsonFromHashTable(null, "faild", "生成支付订单失败")); } }
public string Execute(Hashtable params_ht) { Hashtable res = params_ht; if (res["UID"] == null || res["UID"].ToString().Trim().Length <= 0 || res["PageNum"] == null || res["PageNum"].ToString().Trim().Length <= 0 || res["CurrentPage"] == null || res["CurrentPage"].ToString().Trim().Length <= 0) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "参数不完整")); } else { try { uid = res["UID"].ToString().Trim(); pageNum = int.Parse(res["PageNum"].ToString().Trim()); currentPage = int.Parse(res["CurrentPage"].ToString().Trim()); if (res["Keyword"] != null && res["Keyword"].ToString().Trim().Length > 0) { keyword = res["Keyword"].ToString().Trim(); } } catch { return(SiteHelper.GetJsonFromHashTable(null, "faild", "数据格式不正确")); } UserInfoManager uim = new UserInfoManager(); ServiceAreaManager areaManager = new ServiceAreaManager(); DataTable parkings = areaManager.GetParkingList(keyword, currentPage, pageNum); if (parkings == null || parkings.Rows.Count <= 0) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "亲,没有数据了")); } else { return(JsonHelper.DataTableToJson("success", "获取数据成功", parkings, "GetParkingList")); } } }
public string Execute(Hashtable params_ht) { Hashtable res = params_ht; if (res["UID"] == null || res["UID"].ToString().Trim().Length <= 0) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "参数不完整")); } else { uid = res["UID"].ToString().Trim(); OrdersManager om = new OrdersManager(); VehicleManager vm = new VehicleManager(); Hashtable order = om.GetUserCurrentOrderVehicle(uid); Hashtable ht = om.GetUserCurrentOrderVehicleGPSNum(uid); if (ht == null) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "您没有车辆无法锁车")); } else { //检测车辆当前开关状态,开:unlock,关:lock if ("lock".CompareTo(SiteHelper.GetHashTableValueByKey(order, "LockState")) == 0) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "已临时锁车,如需还车请点击还车,以免额外计费")); } string vid = SiteHelper.GetHashTableValueByKey(ht, "VID"); bool isSuccess = vm.CloseVehicle(vid); if (!isSuccess) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "临时锁车失败,请稍后重试")); } else { return(SiteHelper.GetJsonFromHashTable(null, "success", "已临时锁车,如需还车请点击还车,以免额外计费")); } } } }
protected override Renderer GetRenderer(Rendering rendering, GetRendererArgs args) { var baseResult = base.GetRenderer(rendering, args); if (!SiteHelper.IsValidSite()) { return(baseResult); } var viewRenderer = baseResult as ViewRenderer; if (viewRenderer == null) { return(baseResult); } return(new ResilientViewRenderer { ViewPath = viewRenderer.ViewPath, Rendering = viewRenderer.Rendering }); }
public void Delete(string id) { IPRestrictionId ipId = new IPRestrictionId(id); Context.Response.StatusCode = (int)HttpStatusCode.NoContent; Site site = (ipId.SiteId != null) ? SiteHelper.GetSite(ipId.SiteId.Value) : null; if (site == null) { return; } IPRestrictionsHelper.GetSection(site, ipId.Path, ManagementUnit.ResolveConfigScope()).RevertToParent(); if (ManagementUnit.ServerManager.GetApplicationHostConfiguration().HasSection(IPRestrictionsGlobals.DynamicIPSecuritySectionName)) { IPRestrictionsHelper.GetDynamicSecuritySection(site, ipId.Path, ManagementUnit.ResolveConfigScope()).RevertToParent(); } ManagementUnit.Current.Commit(); }