private void uxSelectFiles_Click(object sender, RoutedEventArgs e) { var of = new OpenFileDialog(); of.Multiselect = true; of.Filter = "All Files (*.*)|*.*"; if (of.ShowDialog() ?? false) { long total = 0; if (currentSettings.UploadFilesIndividually) total = of.Files.Max(o => o.Length); else total = of.Files.Sum(o => o.Length); //this amount doesn't consider message overhead size; so really we could probably add 200-300 bytes to the file sizes and compare against that. total += 300; //this is just an arbitrary amount; semi-safe guess. total /= 1024; //convert to KB if (total <= currentSettings.MaxUploadSize) { try { IHttpUtility utility = null; if (currentSettings.UploadChunked) utility = new HttpChunkUtility(currentSettings.ChunkSize); else utility = new HttpUtility(); utility.UploadCompleted += new Action<UploadCompletedEventArgs>(utility_UploadCompleted); utility.FileSequenceProgressReport += new Action<ProgressReportEventArgs>(utility_FileSequenceProgressReport); utility.FileContentProgressReport += new Action<ProgressReportEventArgs>(utility_FileContentProgressReport); callScriptStartup(); utility.PostFileContents(currentSettings.PostUrl, of.Files, currentSettings.UploadFilesIndividually ? FilePostBehavior.OneAtATime : FilePostBehavior.AllAtOnce, currentSettings.CustomData, this.Dispatcher); //default chunk } catch (Exception ex) { utility_UploadCompleted(new UploadCompletedEventArgs() { Success = false, Message = ex.Message }); } } else utility_UploadCompleted(new UploadCompletedEventArgs() { Success = false, Message = string.Format("File size too large. The current files size limit is, {0} MB" , (currentSettings.MaxUploadSize / 1024 ).ToString("N2"))}); } }
protected BaseResource(Guid merchantKey, string resourceName, Uri hostUri, NameValueCollection customHeaders) { if (merchantKey == Guid.Empty) { merchantKey = ConfigurationUtility.GetConfigurationKey("MerchantKey"); } this.HttpUtility = new HttpUtility(); System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; this.MerchantKey = merchantKey; if (hostUri != null) { this._hostUri = hostUri.ToString(); this._hostUri = this._hostUri.Remove(this._hostUri.Length - 1); } else { this._hostUri = this.GetServiceUri(); } this._resourceName = resourceName; this._customHeader = customHeaders; }
public static string GetUserIdFromRequest(HttpRequest request) { return(HttpUtility.UrlDecode(request.QueryString[UserIdKey])); }
/// <summary> /// Checks if it is necessary to redirect to SharePoint for user to authenticate. /// </summary> /// <param name="httpContext">The HTTP context.</param> /// <param name="redirectUrl">The redirect url to SharePoint if the status is ShouldRedirect. <c>Null</c> if the status is Ok or CanNotRedirect.</param> /// <returns>Redirection status.</returns> public static RedirectionStatus CheckRedirectionStatus(HttpContextBase httpContext, out Uri redirectUrl) { if (httpContext == null) { throw new ArgumentNullException("httpContext"); } redirectUrl = null; bool contextTokenExpired = false; try { if (SharePointContextProvider.Current.GetSharePointContext(httpContext) != null) { return(RedirectionStatus.Ok); } } catch (SecurityTokenExpiredException) { contextTokenExpired = true; } const string SPHasRedirectedToSharePointKey = "SPHasRedirectedToSharePoint"; if (!string.IsNullOrEmpty(httpContext.Request.QueryString[SPHasRedirectedToSharePointKey]) && !contextTokenExpired) { return(RedirectionStatus.CanNotRedirect); } Uri spHostUrl = SharePointContext.GetSPHostUrl(httpContext.Request); if (spHostUrl == null) { return(RedirectionStatus.CanNotRedirect); } if (StringComparer.OrdinalIgnoreCase.Equals(httpContext.Request.HttpMethod, "POST")) { return(RedirectionStatus.CanNotRedirect); } Uri requestUrl = httpContext.Request.Url; var queryNameValueCollection = HttpUtility.ParseQueryString(requestUrl.Query); // Removes the values that are included in {StandardTokens}, as {StandardTokens} will be inserted at the beginning of the query string. queryNameValueCollection.Remove(SharePointContext.SPHostUrlKey); queryNameValueCollection.Remove(SharePointContext.SPAppWebUrlKey); queryNameValueCollection.Remove(SharePointContext.SPLanguageKey); queryNameValueCollection.Remove(SharePointContext.SPClientTagKey); queryNameValueCollection.Remove(SharePointContext.SPProductNumberKey); // Adds SPHasRedirectedToSharePoint=1. queryNameValueCollection.Add(SPHasRedirectedToSharePointKey, "1"); UriBuilder returnUrlBuilder = new UriBuilder(requestUrl); returnUrlBuilder.Query = queryNameValueCollection.ToString(); // Inserts StandardTokens. const string StandardTokens = "{StandardTokens}"; string returnUrlString = returnUrlBuilder.Uri.AbsoluteUri; returnUrlString = returnUrlString.Insert(returnUrlString.IndexOf("?") + 1, StandardTokens + "&"); // Constructs redirect url. string redirectUrlString = TokenHelper.GetAppContextTokenRequestUrl(spHostUrl.AbsoluteUri, Uri.EscapeDataString(returnUrlString)); redirectUrl = new Uri(redirectUrlString, UriKind.Absolute); return(RedirectionStatus.ShouldRedirect); }
internal static ClientContext GetCachedContext(string url) { return(ContextCache.FirstOrDefault(c => HttpUtility.UrlEncode(c.Url) == HttpUtility.UrlEncode(url))); }
internal void CacheContext() { var c = ContextCache.FirstOrDefault(cc => HttpUtility.UrlEncode(cc.Url) == HttpUtility.UrlEncode(Context.Url)); if (c == null) { ContextCache.Add(Context); } }
public static string ParseTextArea(string attributeName, string attributes, FieldInfo fieldInfo, FieldSettings settings) { return $@"<textarea {attributes}>{HttpUtility.HtmlDecode(fieldInfo.Value)}</textarea>"; }
public static string HtmlDecode(this string input) { return HttpUtility.HtmlDecode(input); }
/// <summary> /// Constructor /// </summary> /// <param name="validator">The validator class</param> /// <param name="signInResponseGenerator">The response generator</param> /// <param name="httpUtility">The utily class used for url encoding and url decoding</param> public SiteFinityController(SignInValidator validator, SignInResponseGenerator signInResponseGenerator,HttpUtility httpUtility) { _validator = validator; _signInResponseGenerator = signInResponseGenerator; _httpUtility = httpUtility; }
/// <summary> /// Evaluates the replacement for each link match. /// </summary> /// <param name="match"> /// The match. /// </param> /// <returns> /// The evaluator. /// </returns> public string Evaluator(Match match) { var relative = match.Groups[1].Value; var absolute = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority); return(match.Value.Replace( relative, string.Format("{0}js.axd?path={1}", Utils.ApplicationRelativeWebRoot, HttpUtility.UrlEncode(absolute + relative)))); }
public (HttpWebRequest request, string queryString) PrepareGet(string relativeUrl, IEnumerable <KeyValuePair <string, string> > parameters) { var u = new UriBuilder(serverUrl); u.Path += relativeUrl; var request = (HttpWebRequest)WebRequest.Create(u.Uri); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; var qs = string.Join("&", parameters .Select(kv => string.Format("{0}={1}", HttpUtility.UrlEncode(kv.Key), HttpUtility.UrlEncode(kv.Value))) .ToArray()); request.ContentLength = Encoding.UTF8.GetByteCount(qs); request.ProtocolVersion = HttpVersion.Version11; request.KeepAlive = true; return(request, qs); }
/// <summary> /// 钻石充值下单 /// </summary> /// <param name="configid"></param> /// <param name="paytype"></param> /// <param name="openid"></param> /// <param name="subtype"></param> /// <returns>AjaxJsonValid</returns> private static AjaxJsonValid CreatePayOrder(int configid, string paytype, string openid, string subtype) { //下单信息 OnLinePayOrder order = new OnLinePayOrder { UserID = _userid, ConfigID = configid, OrderAddress = GameRequest.GetUserIP() }; switch (paytype) { case "wx": order.ShareID = 101; order.OrderID = Fetch.GetOrderIDByPrefix("WXAPP"); break; case "zfb": order.ShareID = 201; order.OrderID = Fetch.GetOrderIDByPrefix("ZFBAPP"); break; case "hwx": order.ShareID = 102; order.OrderID = Fetch.GetOrderIDByPrefix("HWX"); break; case "lq": order.ShareID = 301; order.OrderID = Fetch.GetOrderIDByPrefix("360LQ"); break; default: _ajv.code = (int)ApiCode.VertyParamErrorCode; _ajv.msg = string.Format(EnumHelper.GetDesc(ApiCode.VertyParamErrorCode), " paytype(充值类型) 错误"); return(_ajv); } //下单操作 Message umsg = FacadeManage.aideTreasureFacade.CreatePayOrderInfo(order, _device); if (umsg.Success) { OnLinePayOrder orderReturn = umsg.EntityList[0] as OnLinePayOrder; if (paytype == "wx" || paytype == "hwx") { _ajv.SetDataItem("PayPackage", GetWxPayPackage(orderReturn, paytype, openid, GameRequest.GetCurrentFullHost())); } else if (paytype == "lq") { LQPay.LQPayRequest request = new LQPay.LQPayRequest(orderReturn, subtype == "zfb" ? "alipay" : "weixin"); _ajv.SetDataItem("PayUrl", HttpUtility.UrlDecode(LQPay.GetPayPackage(request.ToUrl("PayUrl")))); } _ajv.SetDataItem("OrderID", orderReturn?.OrderID ?? ""); } _ajv.SetValidDataValue(umsg.Success); _ajv.code = umsg.MessageID; _ajv.msg = umsg.Content; return(_ajv); }
/// <summary> /// Constructor /// </summary> /// <param name="httpUtility">The utility class used to url encode and decode</param> /// <param name="simpleWebTokenParser">the parser class used to parse the simple web token</param> public SignInResponseGenerator(HttpUtility httpUtility, SimpleWebTokenParser simpleWebTokenParser) { _httpUtility = httpUtility; _simpleWebTokenParser = simpleWebTokenParser; }
public static string GetUserConfirmationRedirectUrl(string code, string userId, HttpRequest request) { var absoluteUri = "/Account/Confirm?" + CodeKey + "=" + HttpUtility.UrlEncode(code) + "&" + UserIdKey + "=" + HttpUtility.UrlEncode(userId); return(new Uri(request.Url, absoluteUri).AbsoluteUri.ToString()); }
public LoginResult GetRefreshToken(bool sisi, out string refreshToken) { string checkToken = sisi ? SisiRefreshToken : TranquilityRefreshToken; if (!string.IsNullOrEmpty(checkToken)) { refreshToken = checkToken; return(LoginResult.Success); } // need PlaintextPassword. if (SecurePassword == null || SecurePassword.Length == 0) { Windows.EVELogin el = new Windows.EVELogin(this, false); bool? result = el.ShowDialog(); if (SecurePassword == null || SecurePassword.Length == 0) { // password is required, sorry dude refreshToken = null; return(LoginResult.InvalidUsernameOrPassword); } } string uri = "https://login.eveonline.com/Account/LogOn?ReturnUrl=%2Foauth%2Fauthorize%2F%3Fclient_id%3DeveLauncherTQ%26lang%3Den%26response_type%3Dcode%26redirect_uri%3Dhttps%3A%2F%2Flogin.eveonline.com%2Flauncher%3Fclient_id%3DeveLauncherTQ%26scope%3DeveClientToken%2520user"; if (sisi) { uri = "https://sisilogin.testeveonline.com/Account/LogOn?ReturnUrl=%2Foauth%2Fauthorize%2F%3Fclient_id%3DeveLauncherTQ%26lang%3Den%26response_type%3Dcode%26redirect_uri%3Dhttps%3A%2F%2Fsisilogin.testeveonline.com%2Flauncher%3Fclient_id%3DeveLauncherTQ%26scope%3DeveClientToken%2520user"; } HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(uri); req.Timeout = 5000; req.AllowAutoRedirect = true; if (!sisi) { req.Headers.Add("Origin", "https://login.eveonline.com"); } else { req.Headers.Add("Origin", "https://sisilogin.testeveonline.com"); } req.Referer = uri; req.CookieContainer = Cookies; req.Method = "POST"; req.ContentType = "application/x-www-form-urlencoded"; using (SecureBytesWrapper body = new SecureBytesWrapper()) { byte[] body1 = Encoding.ASCII.GetBytes(String.Format("UserName={0}&Password="******"Invalid username / password")) { refreshToken = null; return(LoginResult.InvalidUsernameOrPassword); } /* * <span id="ValidationContainer"><div class="validation-summary-errors"><span>Login failed. Possible reasons can be:</span> * <ul><li>Invalid username / password</li> * </ul></div></span> */ // https://login.eveonline.com/launcher?client_id=eveLauncherTQ#access_token=l4nGki1CTUI7pCQZoIdnARcCLqL6ZGJM1X1tPf1bGKSJxEwP8lk_shS19w3sjLzyCbecYAn05y-Vbs-Jm1d1cw2&token_type=Bearer&expires_in=43200 //accessToken = new Token(resp.ResponseUri); refreshCode = HttpUtility.ParseQueryString(resp.ResponseUri.Query).Get("code"); // String expires_in = HttpUtility.ParseQueryString(fromUri.Fragment).Get("expires_in"); } GetTokensFromCode(sisi, refreshCode); throw new NotImplementedException(); if (!sisi) { TranquilityRefreshToken = refreshToken; } else { SisiRefreshToken = refreshToken; } return(LoginResult.Success); }
public static string CreateQuery(Dictionary <string, string> args, bool customEncoding = false) { if (args != null && args.Count > 0) { return(string.Join("&", args.Select(x => x.Key + "=" + (customEncoding ? URLEncode(x.Value) : HttpUtility.UrlEncode(x.Value))).ToArray())); } return(""); }
protected override string FormatTexSpan(string tex) { return("`" + HttpUtility.HtmlEncode(tex) + "`"); }
public void Export(string format, int pageIndex, int pageSize, string iSortCol, string sSortDir, string where, string order, dynamic columnsVisible) { var exportFormatType = (ExportFormatType)Enum.Parse( typeof(ExportFormatType), format, true); string[] arrayColumnsVisible = ((string[])columnsVisible)[0].ToString().Split(','); where = HttpUtility.UrlEncode(where); if (!_tokenManager.GenerateToken()) return; _ITipo_de_ExtradiccionApiConsumer.SetAuthHeader(_tokenManager.Token); NameValueCollection filter = Request.QueryString; var configuration = new GridConfiguration() { OrderByClause = "", WhereClause = "" }; if (filter != null) configuration = GridQueryHelper.GetDataTableConfiguration(filter, new Tipo_de_ExtradiccionPropertyMapper()); if (!String.IsNullOrEmpty(where)) { configuration.WhereClause = configuration.WhereClause == "" ? where : "(" + configuration.WhereClause + " AND " + where + ")"; } if (!String.IsNullOrEmpty(order)) { configuration.OrderByClause = order; } //Adding Advance Search if (Session["AdvanceSearch"] != null && pageSize != 0) { var advanceFilter = (Tipo_de_ExtradiccionAdvanceSearchModel)Session["AdvanceSearch"]; configuration.WhereClause = configuration.WhereClause == "" ? GetAdvanceFilter(advanceFilter) : configuration.WhereClause + " AND " + GetAdvanceFilter(advanceFilter); } string sortDirection = "asc"; Tipo_de_ExtradiccionPropertyMapper oTipo_de_ExtradiccionPropertyMapper = new Tipo_de_ExtradiccionPropertyMapper(); if (Request.QueryString["sSortDir"] != null) { sortDirection = Request.QueryString["sSortDir"]; } configuration.OrderByClause = oTipo_de_ExtradiccionPropertyMapper.GetPropertyName(iSortCol) + " " + sortDirection; pageSize = pageSize == 0 ? int.MaxValue : pageSize; var result = _ITipo_de_ExtradiccionApiConsumer.ListaSelAll((pageIndex * pageSize) - pageSize + 1, pageSize + ((pageIndex * pageSize) - pageSize), configuration.WhereClause, configuration.OrderByClause ?? "").Resource; if (result.Tipo_de_Extradiccions == null) result.Tipo_de_Extradiccions = new List<Tipo_de_Extradiccion>(); var data = result.Tipo_de_Extradiccions.Select(m => new Tipo_de_ExtradiccionGridModel { Clave = m.Clave ,Descripcion = m.Descripcion }).ToList(); switch (exportFormatType) { case ExportFormatType.PDF: PdfConverter.ExportToPdf(data.ToDataTable(45689, arrayColumnsVisible), "Tipo_de_ExtradiccionList_" + DateTime.Now.ToString()); break; case ExportFormatType.EXCEL: ExcelConverter.ExportToExcel(data.ToDataTable(45689, arrayColumnsVisible), "Tipo_de_ExtradiccionList_" + DateTime.Now.ToString()); break; case ExportFormatType.CSV: CsvConverter.ExportToCSV(data.ToDataTable(45689, arrayColumnsVisible), "Tipo_de_ExtradiccionList_" + DateTime.Now.ToString()); break; } }
protected override string FormatTexDiv(string tex) { return("[mathjax]" + HttpUtility.HtmlEncode(tex) + "[/mathjax]"); }
public static string HtmlAttributeEncode(this string input) { return HttpUtility.HtmlAttributeEncode(input); }
protected virtual string FormatTexSpan(string tex) { return("<span class='tex'>" + HttpUtility.HtmlEncode(tex) + "</span>"); }
public void RestoreCachedContext(string url) { Context = ContextCache.FirstOrDefault(c => HttpUtility.UrlEncode(c.Url) == HttpUtility.UrlEncode(url)); }
protected virtual string FormatTexDiv(string tex) { return("</p><div class='tex'>\\displaystyle " + HttpUtility.HtmlEncode(tex) + "</div><p>"); }
public ClientContext CloneContext(string url) { var context = ContextCache.FirstOrDefault(c => HttpUtility.UrlEncode(c.Url) == HttpUtility.UrlEncode(url)); if (context == null) { context = Context.Clone(url); ContextCache.Add(context); } Context = context; return(context); }
// // GET: /HelloWorld/Welcome/ public string Welcome(string name, int numTimes = 1) { return(HttpUtility.HtmlEncode("Hello " + name + ", NumTimes is: " + numTimes)); }
/// <summary> /// 文件的限速下载 /// </summary> /// <param name="filePath"></param> /// <param name="speed"></param> /// <returns></returns> bool ISpeedLimit.Download(string filePath, int speed) { // 限速时每个包的时间 每秒下载多少MB double time = 1000 / ((speed * 1024 * 1024) / bufferSize); byte[] buffer = new byte[bufferSize]; using (FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read)) using (BinaryReader binaryReader = new BinaryReader(fileStream)) { _HttpResponse.ContentType = HttpContentType.APPLICATION_OCTET_STREAM; _HttpResponse.Headers.Add("Content-Disposition", $"attachment;filename={ HttpUtility.UrlEncode(Path.GetFileName(filePath), Encoding.UTF8) }");// Stopwatch stopwatch = new Stopwatch(); //循环读取下载文件的内容,并发送到客户端浏览器 int contentLength; do { //检测客户端浏览器和服务器之间的连接状态,如果返回true,说明客户端浏览器中断了连接 //这立刻break,取消下载文件的读取和发送,避免服务器耗费资源 if (_HttpContext.RequestAborted.IsCancellationRequested) { return(false); } stopwatch.Restart(); //从下载文件中读取bufferSize(1024字节)大小的内容到服务器内存中 contentLength = binaryReader.Read(buffer, 0, bufferSize); //发送读取的内容数据到客户端浏览器 _HttpResponse.Body.Write(buffer); //注意每次Write后,要及时调用Flush方法,及时释放服务器内存空间 _HttpResponse.Body.Flush(); stopwatch.Stop(); //如果实际带宽小于限制时间就不需要等待 if (stopwatch.ElapsedMilliseconds < time) { Thread.Sleep((int)(time - stopwatch.ElapsedMilliseconds)); } } while (contentLength != 0); return(true); } }
public static string UrlEncode(this string value) { return HttpUtility.UrlEncode(value); }
private void MyDataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) { ((HtmlAnchor)e.Item.FindControl("hrefset")).HRef = "javascript:Popolast('" + HttpUtility.HtmlDecode(e.Item.Cells[1].Text).Replace("\"", "\\\"") + "','" + e.Item.Cells[4].Text + "');"; } }
public static string AttributeEncode(this string value) { return HttpUtility.HtmlAttributeEncode(value); }
public static string GetResetPasswordRedirectUrl(string code, HttpRequest request) { var absoluteUri = "/Account/ResetPassword?" + CodeKey + "=" + HttpUtility.UrlEncode(code); return(new Uri(request.Url, absoluteUri).AbsoluteUri.ToString()); }
public static string HtmlDecode(this string value) { return HttpUtility.HtmlDecode(value); }
public ActionResult Quotation(string metatitle, long id, TblCommentModel model, FormCollection form) { try { const string verifyUrl = "https://www.google.com/recaptcha/api/siteverify"; var secret = ConfigurationManager.AppSettings["SecretKey"]; var response = form["g-recaptcha-response"]; var remoteIp = Request.ServerVariables["REMOTE_ADDR"]; var myParameters = String.Format("secret={0}&response={1}&remoteip={2}", secret, response, remoteIp); using (var wc = new WebClient()) { wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; var json = wc.UploadString(verifyUrl, myParameters); var js = new DataContractJsonSerializer(typeof(CapchaRespond)); var ms = new MemoryStream(Encoding.ASCII.GetBytes(json)); var result = js.ReadObject(ms) as CapchaRespond; if (result != null && result.Success) // SUCCESS!!! { if (ModelState.IsValid) { TblComment o = new TblComment(); o.Name = model.Name; o.Content = model.Content; o.NewsId = id; o.CreateDate = DateTime.Now; o.IsAd = false; new TblCommentDao().Create(o); return(RedirectToAction("NewsDetail", "Home", new { id = id, metatitle = HttpUtility.UrlDecode(metatitle) })); } } } return(View()); } catch (Exception ex) { logger.Info("Home" + "::Quotation::" + ex.Message); return(RedirectToAction("Index", "Error")); } }
/* [HttpGet] public ActionResult GetTipo_de_ExtradiccionAll() { try { if (!_tokenManager.GenerateToken()) return Json(null, JsonRequestBehavior.AllowGet); _ITipo_de_ExtradiccionApiConsumer.SetAuthHeader(_tokenManager.Token); var result = _ITipo_de_ExtradiccionApiConsumer.SelAll(false).Resource; return Json(result.OrderBy(m => m.).Select(m => new SelectListItem { Text = CultureHelper.GetTraductionNew(Convert.ToString(m.Clave), "Tipo_de_Extradiccion", m.), Value = Convert.ToString(m.Clave) }).ToArray(), JsonRequestBehavior.AllowGet); } catch (ServiceException ex) { return Json(null, JsonRequestBehavior.AllowGet); } } */ /// <summary> /// Get List of Tipo_de_Extradiccion from Web API. /// </summary> /// <param name="draw"></param> /// <param name="start"></param> /// <param name="length"></param> /// <returns>Return List of Tipo_de_Extradiccion Entity</returns> public ActionResult GetTipo_de_ExtradiccionList(UrlParametersModel param) { int sEcho = param.sEcho; int iDisplayStart = param.iDisplayStart; int iDisplayLength = param.iDisplayLength; string where = param.where; string order = param.order; where = HttpUtility.UrlEncode(where); int sortColumn = -1; string sortDirection = "asc"; if (iDisplayLength == -1) { //length = TOTAL_ROWS; iDisplayLength = Int32.MaxValue; } // note: we only sort one column at a time if (param.sortColumn != null) { sortColumn = int.Parse(param.sortColumn); } if (param.sortDirection != null) { sortDirection = param.sortDirection; } if (!_tokenManager.GenerateToken()) return null; _ITipo_de_ExtradiccionApiConsumer.SetAuthHeader(_tokenManager.Token); NameValueCollection filter = HttpUtility.ParseQueryString(param.filters); var configuration = new GridConfiguration() { OrderByClause = "", WhereClause = "" }; if (filter != null) configuration = GridQueryHelper.GetDataTableConfigurationNew(param, new Tipo_de_ExtradiccionPropertyMapper()); if (!String.IsNullOrEmpty(where)) { configuration.WhereClause = configuration.WhereClause == "" ? where : "(" + configuration.WhereClause + " AND " + where + ")"; } if (!String.IsNullOrEmpty(order)) { configuration.OrderByClause = order; } //Adding Advance Search if (param.AdvanceSearch != null && param.AdvanceSearch == true && Session["AdvanceSearch"] != null) { if (Session["AdvanceSearch"].GetType() == typeof(Tipo_de_ExtradiccionAdvanceSearchModel)) { var advanceFilter = (Tipo_de_ExtradiccionAdvanceSearchModel)Session["AdvanceSearch"]; configuration.WhereClause = configuration.WhereClause == "" ? GetAdvanceFilter(advanceFilter) : configuration.WhereClause + " AND " + GetAdvanceFilter(advanceFilter); } else { Session.Remove("AdvanceSearch"); } } Tipo_de_ExtradiccionPropertyMapper oTipo_de_ExtradiccionPropertyMapper = new Tipo_de_ExtradiccionPropertyMapper(); if (String.IsNullOrEmpty(order)) { if (sortColumn != -1) configuration.OrderByClause = oTipo_de_ExtradiccionPropertyMapper.GetPropertyName(param.columns[sortColumn].name) + " " + sortDirection; } var pageSize = iDisplayLength; var pageIndex = (iDisplayStart / iDisplayLength) + 1; var result = _ITipo_de_ExtradiccionApiConsumer.ListaSelAll((pageIndex * pageSize) - pageSize + 1, pageSize + ((pageIndex * pageSize) - pageSize), configuration.WhereClause, configuration.OrderByClause ?? "").Resource; if (result.Tipo_de_Extradiccions == null) result.Tipo_de_Extradiccions = new List<Tipo_de_Extradiccion>(); return Json(new { aaData = result.Tipo_de_Extradiccions.Select(m => new Tipo_de_ExtradiccionGridModel { Clave = m.Clave ,Descripcion = m.Descripcion }).ToList(), iTotalRecords = result.RowCount, iTotalDisplayRecords = result.RowCount, sEcho = sEcho }, JsonRequestBehavior.AllowGet); }
private void setCleanLine(Literal literalItem, string fieldData) { literalItem.Text = (string.IsNullOrWhiteSpace(fieldData)) ? _NotSpecifiedLine : HttpUtility.HtmlEncode(fieldData); }
//////////////////////////////////////////////////////////////////// //Utility //////////////////////////////////////////////////////////////////// public void SetHttpUtility( HttpUtility h ){ http = h; }