public ModelCourseData(OnlineCourseData item) { name = item.name; linkUrl = item.dataLink; imgUrl = WebFunctions.ToAbsoluteResourceUrl(item.img); sort = item.sort; }
private void btnTestWFS_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; string url = txtWFSUrl.Text.Trim(); if (!String.IsNullOrEmpty(txtServiceName.Text.Trim())) { url = WebFunctions.AppendParametersToUrl(url, "ServiceName=" + txtServiceName.Text.Trim()); } string param = "REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WFS"; url = WebFunctions.AppendParametersToUrl(url, param); string capabilities = WebFunctions.RemoveDOCTYPE(WebFunctions.DownloadXml(url)); XmlDocument doc = new XmlDocument(); doc.LoadXml(capabilities); xmlViewTree1.XmlDocument = doc; } catch (Exception ex) { this.Cursor = Cursors.Default; MessageBox.Show("ERROR: " + ex.Message); } finally { this.Cursor = Cursors.Default; } }
async public override Task <bool> Refresh() { await base.Refresh(); try { string server = ConfigTextStream.ExtractValue(_connectionString, "server"); string user = ConfigTextStream.ExtractValue(_connectionString, "user"); string pwd = ConfigTextStream.ExtractValue(_connectionString, "pwd"); var url = server .UrlAppendPath(this._name) .UrlAppendParameters("f=json"); if (!String.IsNullOrEmpty(user) && !String.IsNullOrEmpty(pwd)) { string token = await RequestTokenCache.RefreshTokenAsync(server, user, pwd); url = url.UrlAppendParameters($"token={token}"); } var jsonServices = await WebFunctions.DownloadObjectAsync <JsonServices>(url); if (jsonServices != null) { if (jsonServices.Folders != null) { foreach (var folder in jsonServices.Folders) { base.AddChildObject( new GeoServicesFolderExplorerObject( this._parent, this._name.UrlAppendPath(folder), _connectionString) ); } } if (jsonServices.Services != null) { foreach (var service in jsonServices.Services.Where(s => s.Type.ToLower() == "mapserver")) { base.AddChildObject( new GeoServicesServiceExplorerObject( this, service.ServiceName, this._name, _connectionString)); } } } return(true); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); return(false); } }
/// <summary> /// 生成二维码并展示到页面上 /// </summary> private void DoWaitProcess(WxPayData result) { string url = result.GetValue("code_url").ToString(); //获得统一下单接口返回的二维码链接 //初始化二维码生成工具 QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(); qrCodeEncoder.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE; qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M; qrCodeEncoder.QRCodeVersion = 0; qrCodeEncoder.QRCodeScale = 4; //将字符串生成二维码图片 Bitmap bt = qrCodeEncoder.Encode(url, Encoding.Default); string filename = System.DateTime.Now.ToString("yyyyMMddHHmmss") + "0000" + (new Random()).Next(1, 10000).ToString() + ".jpg"; string vPath = string.Format("/Images/QrCode/WxPay/{0}/{1}", DateTime.Now.ToString("yyyy-MM-dd"), filename); string pPath = WebFunctions.MapServerResourcePath(vPath); WebFunctions.CreateDirectory(pPath); bt.Save(pPath); var relativelyPath = WebFunctions.ResourceMapRoot + vPath; qrCodeUrl = WebFunctions.ToAbsoluteResourceUrl(relativelyPath.TrimStart('~')); //轮询订单结果 //根据业务需要,选择是否新起线程进行轮询 }
static void Main(string[] args) { Runtimes OSinfo; List <string> test = new List <string>(); Console.WriteLine("Downloading JSON..."); WebFunctions webHelper = new WebFunctions(); // The path of the JSON object has the OS names to be used try { OSinfo = webHelper.DownloadJsonOSList(); foreach (var item in OSinfo.OSList) { test.Add(item.Path); if (!item.Path.Contains("['")) { Console.WriteLine(item.Path); } } } catch (Exception ex) { Console.WriteLine("Download failed"); } finally { Console.WriteLine("Downloaded successfully!"); } Console.ReadKey(); }
public string Send(string service, string request, string InterpreterGUID, string user, string pwd) { string ret = WebFunctions.HttpSendRequest(_url + "/MapRequest/" + InterpreterGUID + "/" + service, "POST", Encoding.UTF8.GetBytes(request), user, pwd, this.Timeout * 1000); return(Encoding.UTF8.GetString(Encoding.Default.GetBytes(ret))); }
public ActionResult Create(string username, string password) { var item = new ADMIN(); item.USER_NAME = username; item.PASSWORD = password; item.IS_DELETE = 0; item.UPDATE_TIME = DateTime.Now; item.ADMIN_ROLE_RELATION = new List <ADMIN_ROLE_RELATION>(); var role = Request.Form["role"]; var rolesId = role.Split(new char[] { ',' }); foreach (var roleId in rolesId) { var rId = WebFunctions.StringToIntNullable(roleId); if (rId.HasValue) { var adminRole = new ADMIN_ROLE_RELATION(); adminRole.ROLE_ID = rId; adminRole.CREATE_TIME = DateTime.Now; adminRole.UPDATE_TIME = DateTime.Now; adminRole.IS_DELETE = 0; item.ADMIN_ROLE_RELATION.Add(adminRole); } } DB.ADMIN.Add(item); DB.SaveChanges(); return(RedirectToAction("Index")); }
/// <summary> /// 生成二维码并展示到页面上 /// </summary> /// <param name="precreateResult">二维码串</param> private void DoWaitProcess(AlipayF2FPrecreateResult precreateResult) { //打印出 preResponse.QrCode 对应的条码 Bitmap bt; string enCodeString = precreateResult.response.QrCode; QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(); qrCodeEncoder.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE; qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.H; qrCodeEncoder.QRCodeScale = 3; qrCodeEncoder.QRCodeVersion = 8; bt = qrCodeEncoder.Encode(enCodeString, Encoding.UTF8); string filename = System.DateTime.Now.ToString("yyyyMMddHHmmss") + "0000" + (new Random()).Next(1, 10000).ToString() + ".jpg"; string vPath = string.Format("/Images/QrCode/AliPay/{0}/{1}", DateTime.Now.ToString("yyyy-MM-dd"), filename); string pPath = WebFunctions.MapServerResourcePath(vPath); WebFunctions.CreateDirectory(pPath); bt.Save(pPath); var relativelyPath = WebFunctions.ResourceMapRoot + vPath; qrCodeUrl = WebFunctions.ToAbsoluteResourceUrl(relativelyPath.TrimStart('~')); //轮询订单结果 //根据业务需要,选择是否新起线程进行轮询 //ParameterizedThreadStart ParStart = new ParameterizedThreadStart(LoopQuery); //Thread myThread = new Thread(ParStart); //object o = precreateResult.response.OutTradeNo; //myThread.Start(o); }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { if (treeView1.SelectedNode != null) { if (treeView1.SelectedNode.Tag is WebServices) { LoadFunctions(); LoadClasses(); } else if (treeView1.SelectedNode.Tag is WebFunctions) { WebFunctions webfunc = treeView1.SelectedNode.Tag as WebFunctions; Utility.WriteTrace(string.Format("Seçilen Fonksiyon: {0}", webfunc.Name)); propertyGrid1.SelectedObject = treeView1.SelectedNode.Tag; } else { Utility.WriteTrace(string.Format("Seçilen Kategori: {0}", treeView1.SelectedNode.Text)); } } else { webserv = null; propertyGrid1.SelectedObject = null; } }
public List <HighScoreEntry> GetScores(string tspName, int orderType, string gameName = AntAlgorithmManager.GameName, int numberOfEntries = AntAlgorithmManager.NumHighScoreEntries) { Debug.Log("Retrieving High Scores..."); ReadHighScoresFinished = false; Result = new List <HighScoreEntry>(); var url = HighscoreURL + "tsp=" + WWW.EscapeURL(tspName) + "&num=" + numberOfEntries + "&order=" + orderType; print(url); WWW hsGet = WebFunctions.Get(url); if (!string.IsNullOrEmpty(hsGet.error)) { print("There was an error getting the high score: " + hsGet.error); } else { foreach (var line in hsGet.text.Split(new[] { "<br>" }, StringSplitOptions.RemoveEmptyEntries)) { var entry = HighScoreEntry.Create(line); if (entry != null) { Result.Add(entry); } } } ReadHighScoresFinished = true; return(Result); }
public ModelQualificationsImage(PlaceholderImage item) { ImgUrl = WebFunctions.ToAbsoluteResourceUrl(item.imgUrl); Name = item.text1; Qualification = item.text2; Sort = item.sort; LinkUrl = item.linkUrl; }
protected long GetUserID() { WebFunctions obj = new WebFunctions(); string user = Request.ServerVariables["AUTH_USER"]; long authUserID = obj.GetSOPUserID(user); return(authUserID); }
public ModelCourse(OnlineCourse item) { id = item.id; title = item.name; simpleIntro = item.simpleIntro; price = item.price.HasValue ? item.price.Value : 0; teacher = item.lecturer; imgUrl = WebFunctions.ToAbsoluteResourceUrl(item.img); }
private string SendRequest_ServletExec(StringBuilder sb, string ServerName, string ServiceName, string CustomService) { // // Sollte beim GET_IMAGE Request auch das file Attribut im OUTPUT tag enthalten sein, // muss im esrimap_prop file (ServletExec/servlets/...) der Wert: // spatialServer.AllowResponsePath=True gesetzt werden (Standard ist false) // string theURL = ServerName; if (ServerName.IndexOf("http") != 0) { theURL = "http://" + theURL; } if (theURL.IndexOf("/", 10) == -1) { theURL += "/" + ServerUrl(ServerName); } if (theURL.IndexOf("?") == -1) { theURL += "?"; } if (theURL.IndexOf("?") != (theURL.Length - 1)) { theURL += "&"; } //string theURL = "http://" + ServerName + "/"+ServerUrl(ServerName)+"?ServiceName=" + ServiceName;// + "&ClientVersion=4.0"; if (ServiceName != "") { theURL += "ServiceName=" + ServiceName + "&ClientVersion=4.0"; } else { theURL += "ClientVersion=4.0"; } if (CustomService != "") { theURL += "&CustomService=" + CustomService; } if (CommaFormat != ',') { string temp = replaceComma(sb.ToString()); sb = new StringBuilder(); sb.Append(temp); } //System.Text.UTF8Encoding encoder=new UTF8Encoding(); //byte [] POSTbytes=encoder.GetBytes(sb.ToString()); byte[] POSTbytes = _encoding.GetBytes(sb.ToString()); return(WebFunctions.HttpSendRequest(theURL, "POST", POSTbytes, _user, _passwd, _encoding)); }
async static public Task <string> RefreshTokenAsync(string serviceUrl, string user, string password, string currentToken = "") { string currentParameter = currentToken; //lock (_refreshTokenLocker) { string dictKey = serviceUrl + "/" + user; if (_tokenParams.ContainsKey(dictKey) && _tokenParams[dictKey] != currentParameter) { return(_tokenParams[dictKey]); } else { int pos = serviceUrl.ToLower().IndexOf("/rest/"); string tokenServiceUrl = serviceUrl.Substring(0, pos) + "/tokens/generateToken"; //string tokenParams = $"request=gettoken&username={ user }&password={ password.UrlEncodePassword() }&expiration={ RequestTokenCache.TicketExpiration }&f=json"; string tokenParams = $"request=gettoken&username={ user }&password={ password.UrlEncodePassword() }&f=json"; string tokenResponse = String.Empty; while (true) { try { tokenResponse = WebFunctions.HttpSendRequest($"{ tokenServiceUrl }?{ tokenParams }"); break; } catch (WebException we) { if (we.Message.Contains("(502)") && tokenServiceUrl.StartsWith("http://")) { tokenServiceUrl = "https:" + tokenServiceUrl.Substring(5); continue; } throw we; } } if (tokenResponse.Contains("\"error\":")) { JsonError error = JsonConvert.DeserializeObject <JsonError>(tokenResponse); throw new Exception($"GetToken-Error:{ error.Error?.Code }\n{ error.Error?.Message }\n{ error.Error?.Details?.ToString() }"); } else { JsonSecurityToken jsonToken = JsonConvert.DeserializeObject <JsonSecurityToken>(tokenResponse); if (jsonToken.token != null) { _tokenParams.TryAdd(dictKey, jsonToken.token); return(jsonToken.token); } } } } return(String.Empty); }
public ModelCompanyInfo(CompanyInfo item) { Tel = item.Tel; Email = item.Email; Address = item.Address; Blog = item.Blog; Chat = item.Chat; QR1 = WebFunctions.ToAbsoluteResourceUrl(item.QR1); QR2 = WebFunctions.ToAbsoluteResourceUrl(item.QR2); }
public bool RemoveMap(string name, string usr, string pwd) { string ret = WebFunctions.HttpSendRequest(_url + "/removemap/" + name, "GET", null, usr, pwd, this.Timeout * 1000); if (ret.ToString().ToLower().Trim() != "true") { LastErrorMessage = ret; return(false); } return(true); }
public bool AddMap(string name, string mxl, string usr, string pwd) { string ret = WebFunctions.HttpSendRequest(_url + "/addmap/" + name, "POST", Encoding.UTF8.GetBytes(mxl), usr, pwd, this.Timeout * 1000); if (ret.ToString().ToLower().Trim() != "true") { LastErrorMessage = ret; return(false); } return(true); }
public ModelPlaceholderImage(PlaceholderImage item) { id = item.id; model = item.model; imgUrl = WebFunctions.ToAbsoluteResourceUrl(item.imgUrl); linkUrl = item.linkUrl; width = item.width; height = item.height; sort = item.sort; linkUrlMB = item.linkUrlMB; }
public ModelTeacher(Teacher item) { id = item.id; photo = WebFunctions.ToAbsoluteResourceUrl(item.photo); name = item.name; description = item.description; lever = item.lever; type = item.type; name_en = item.name_en; sort = item.sort; }
async public override Task <bool> Refresh() { await base.Refresh(); try { ServerConnection service = new ServerConnection(ConfigTextStream.ExtractValue(_connectionString, "server")); //string axl = service.ServiceRequest("catalog", "<GETCLIENTSERVICES/>", "BB294D9C-A184-4129-9555-398AA70284BC", // ConfigTextStream.ExtractValue(_connectionString, "user"), // Identity.HashPassword(ConfigTextStream.ExtractValue(_connectionString, "pwd"))); string axl = WebFunctions.HttpSendRequest("http://" + ConfigTextStream.ExtractValue(_connectionString, "server") + "/catalog?format=xml", "GET", null, ConfigTextStream.ExtractValue(_connectionString, "user"), ConfigTextStream.ExtractValue(_connectionString, "pwd")); if (String.IsNullOrEmpty(axl)) { return(false); } XmlDocument doc = new XmlDocument(); doc.LoadXml(axl); foreach (XmlNode mapService in doc.SelectNodes("//SERVICE[@name]")) { MapServiceType type = MapServiceType.MXL; if (mapService.Attributes["servicetype"] != null) { switch (mapService.Attributes["servicetype"].Value.ToLower()) { case "mxl": type = MapServiceType.MXL; break; case "svc": type = MapServiceType.SVC; break; case "gdi": type = MapServiceType.GDI; break; } } base.AddChildObject(new MapServerServiceExplorerObject(this, mapService.Attributes["name"].Value, _connectionString, type)); } return(true); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); return(false); } }
public ModelReview(Review item) { id = item.id; comment = item.comment; up = item.up; createdTime = item.createdTime; if (item.Customer != null) { customerMobile = item.Customer.MOBILE; customerImg = WebFunctions.GetCustomerPortrait(item.Customer.HEAD_PORTEAIT); } }
public void ResetPassword() { var usersUsername = DBContext.GetUsernameFromEmail(emailR.text); Debug.Log(usersUsername); resetCode = WebFunctions.Generate6CharResetCode(); WebFunctions.SendResetEmail(emailR.text, usersUsername, resetCode); // Tkae them to the next screen }
public string QueryMetadata(string service, string user, string password) { try { return(WebFunctions.HttpSendRequest(_url + "/getmetadata/" + service, "GET", null, user, password, this.Timeout * 1000)); } catch (Exception ex) { return("ERROR:" + ex.Message); } }
public bool UploadMetadata(string service, string metadata, string user, string password) { try { return(WebFunctions.HttpSendRequest(_url + "/setmetadata/" + service, "POST", Encoding.UTF8.GetBytes(metadata), user, password, this.Timeout * 1000).ToLower().Trim() == "true"); } catch (Exception ex) { return(false); } }
public void TimeSeriesChartSecondOrderResponseTest() { var startTimestamp = DateTime.Today; var table = SecondOrderGraphWithValueIssues(startTimestamp); var endTimestamp = table.Last().Key; var timeSeriesChart = new TimeSeriesChart(); var result = timeSeriesChart.ChartDataFor(table, new AxisLimits(startTimestamp, endTimestamp, new Dimension(0.7, 1.6)), new Size(800, 600)); result = WebFunctions.AsImg(result); AssertChartImage(result, SecondOrderResponseLimitedYFile, nameof(TimeSeriesChartSecondOrderResponseTest)); }
private void treeView1_AfterCheck(object sender, TreeViewEventArgs e) { if (e.Node.Tag != null) { WebFunctions webfunc = e.Node.Tag as WebFunctions; if (webfunc != null) { propertyGrid1.SelectedObject = webfunc; webfunc.Output = e.Node.Checked; webfunc.Save(); //LoadFunctions(); } } }
public ModelCustomer(Customer item) { id = item.CUSTOMER_ID; mobile = item.MOBILE; realName = item.REAL_NAME; sex = item.SEX; birthday = item.BIRTHDAY.HasValue ? item.BIRTHDAY.Value.ToString("yyyy-MM-dd") : string.Empty; province = item.PROVINCE; market = item.MARKET; intro = item.intro; qualification = item.qualification; periods = item.periods; customerImg = WebFunctions.GetCustomerPortrait(item.HEAD_PORTEAIT); }
public void PostScores(string userName, string tspName, double algoScore, int algoBestIteration, string algoTour, double userScore, int userBestIteration, string userTour, int timeInMillis, Guid guid, string platform ) { string url = AddScoreURL.TrimEnd('?'); var postValues = new Dictionary <string, string>(); postValues["name"] = userName; postValues["tspname"] = tspName; postValues["algoscore"] = algoScore.ToString(); postValues["algobestiteration"] = algoBestIteration.ToString(); postValues["algotour"] = algoTour; postValues["userscore"] = userScore.ToString(); postValues["userbestiteration"] = userBestIteration.ToString(); postValues["usertour"] = userTour; postValues["time"] = timeInMillis.ToString(); postValues["ID"] = guid.ToString(); postValues["platform"] = platform.ToString(); postValues["hash"] = Hash(SecretKey); #if UNITY_STANDALONE_WIN var hsPost = WebFunctions.Post(url, postValues); print("HSPOST " + hsPost.url); if (!string.IsNullOrEmpty(hsPost.error)) { print("There was an error posting the high score: " + hsPost.error); } #endif #if UNITY_WEBGL || UNITY_IOS || UNITY_ANDROID || UNITY_WP8 || UNITY_IPHONE StartCoroutine(PostScoresAsync(guid, userName, tspName, algoScore, algoBestIteration, algoTour, userScore, userBestIteration, userTour, timeInMillis, platform)); #endif }
public List <MapService> Services(string user, string password) { List <MapService> services = new List <MapService>(); DateTime td = DateTime.Now; string axl = String.Empty; axl = WebFunctions.HttpSendRequest(_url + "/catalog", "POST", Encoding.UTF8.GetBytes("<GETCLIENTSERVICES/>"), user, password, this.Timeout * 1000); TimeSpan ts = DateTime.Now - td; int millisec = ts.Milliseconds; if (axl == "") { return(services); } XmlDocument doc = new XmlDocument(); doc.LoadXml(axl); foreach (XmlNode mapService in doc.SelectNodes("//SERVICE[@name]")) { MapService.MapServiceType type = MapService.MapServiceType.MXL; if (mapService.Attributes["servicetype"] != null) { switch (mapService.Attributes["servicetype"].Value.ToLower()) { case "mxl": type = MapService.MapServiceType.MXL; break; case "svc": type = MapService.MapServiceType.SVC; break; case "gdi": type = MapService.MapServiceType.GDI; break; } } services.Add(new MapService(mapService.Attributes["name"].Value, type)); } return(services); }