public dynamic EvaluateExpression(Node tree, KEntity entity, Models.Pagination viewDetails, Dictionary <string, AliasReference> classNameAlias, dynamic businessData, dynamic kresult, string queryString, out bool hasData, Dictionary <string, long> functionLog, bool isDetailsView = false, bool isNFSite = false, string developerId = null) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); try { string baseClassName = entity.Classes.Where(c => c.ClassType == KClassType.BaseClass).FirstOrDefault().Name; ReplaceExpressionsInTreeAsync(tree, baseClassName, viewDetails, classNameAlias, businessData, entity, kresult, queryString, isDetailsView, isNFSite, developerId); Token result = ParseTress.Parse(tree); if (result?.Type == null) { hasData = false; } else { hasData = result.Type != TOKENTYPE.NoData; } return(result?.Value ?? ""); } catch (Exception ex) { throw; } finally { stopwatch.Stop(); Helper.UpdateFunctionLog(functionLog, String.Format(Constant.EVALUATE_EXPRESSION, "Tree"), stopwatch.ElapsedMilliseconds); } }
public void UpdateEntry1(Models.Pagination page) { int entryIndex = Array.FindIndex(_page, e => e.no == page.no); if (entryIndex == -1) { throw new Exception( string.Format("Unable to find an entry with an ID of {0}", page.no)); } PaginationRepository._page[entryIndex] = page; }
public void DeleteEntry(Models.Pagination page) { // Find the index of the entry that we need to delete. int entryIndex = Array.FindIndex(_page, e => e.no == page.no); if (entryIndex == -1) { throw new Exception( string.Format("Unable to find an entry with an ID of {0}", page.no)); } _page = _page.Where((val, idx) => idx != entryIndex).ToArray(); }
public Models.Pagination getDel(int id) { Models.Pagination pageClick = new Models.Pagination(); foreach (var page in _page) { if (page.no == id) { pageClick = page; break; } } return(pageClick); }
public Models.Pagination getPage(int id) { Models.Pagination pageClick = new Models.Pagination(); /*foreach(var page in _page) * { * if(page.no == id) * { * pageClick = page; * break; * } * }*/ return(_page[id - 1]); }
/// <summary> /// Async Process /// </summary> /// <param name="cancellationToken"></param> /// <returns></returns> public override System.Threading.Tasks.Task <System.Net.Http.HttpResponseMessage> ExecuteAsync(System.Threading.CancellationToken cancellationToken) { //------------------------------------------------------------------------------------------------------ // GUARD EXCEPTIONS Gale.Exception.RestException.Guard(() => _latitude == null, "LATITUDE_EMPTY", API.Errors.ResourceManager); Gale.Exception.RestException.Guard(() => _longitude == null, "LONGITUDE_EMPTY", API.Errors.ResourceManager); Gale.Exception.RestException.Guard(() => _distance == null, "DISTANCE_EMPTY", API.Errors.ResourceManager); //------------------------------------------------------------------------------------------------------ using (Gale.Db.DataService svc = new Gale.Db.DataService("[PA_MOT_OBT_DescubrirRutas]")) { svc.Parameters.Add("USUA_Token", HttpContext.Current.User.PrimarySid()); svc.Parameters.Add("Nombre", _route); svc.Parameters.Add("Distancia", _distance); svc.Parameters.Add("Latitud", _latitude); svc.Parameters.Add("Longitud", _longitude); svc.Parameters.Add("RegistrosPorPagina", _limit); svc.Parameters.Add("RegistrosSaltados", _offset); Gale.Db.EntityRepository rep = this.ExecuteQuery(svc); Models.Pagination pagination = rep.GetModel <Models.Pagination>(0).FirstOrDefault(); List <Models.DiscoveredRoute> routes = rep.GetModel <Models.DiscoveredRoute>(1); //---------------------------------------------------------------------------------------------------- //Create Response var response = new HttpResponseMessage(System.Net.HttpStatusCode.OK) { Content = new ObjectContent <Object>( new { offset = _offset, limit = _limit, total = pagination.total, items = routes }, System.Web.Http.GlobalConfiguration.Configuration.Formatters.KqlFormatter() ) }; //Return Task return(Task.FromResult(response)); //---------------------------------------------------------------------------------------------------- } }
public void AddEntry1(Models.Pagination page) { // Get the next available entry ID. int nextAvailableEntryId; try { nextAvailableEntryId = PaginationRepository._page .Max(e => e.no) + 1; } catch { nextAvailableEntryId = 1; } page.no = nextAvailableEntryId; List <Models.Pagination> lst = _page.OfType <Models.Pagination>().ToList(); lst.Add(page); _page = lst.ToArray(); }
/// <summary> /// 查询代办列表 /// </summary> /// yand 15.11.27 /// qiy 16.03.08 /// yand 16.07.25(添加主要信息字段) /// <param name="page"></param> /// <param name="filters"></param> /// <returns></returns> public DataTable DoingList(Models.Pagination page, NameValueCollection filters) { var user = new User.User().CurrentUser(); filters.Add("CurrentUser", user.UserId.ToString()); filters.Add("CurrentRole", user.RoleId.ToString()); DataTable dt = instanceMapper.FindDoingList(page, filters); dt.Columns.Add("MainInfo", Type.GetType("System.String")); //代办列表有值 if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { CarHomeInfo carHome = new CarHomeInfo(); if (!string.IsNullOrEmpty(dt.Rows[i]["VehicleKey"].ToString())) { carHome = new DAL.Vehicle.CarHomeMapper().FindCarInfo(dt.Rows[i]["VehicleKey"].ToString()); } if (!string.IsNullOrEmpty(dt.Rows[i]["Name"].ToString())) { dt.Rows[i]["MainInfo"] = "客户姓名:" + dt.Rows[i]["Name"]; } if (!string.IsNullOrEmpty(dt.Rows[i]["PlateNo"].ToString())) { dt.Rows[i]["MainInfo"] += " 车牌号:" + dt.Rows[i]["PlateNo"]; } if (!string.IsNullOrEmpty(carHome.Vehicle)) { dt.Rows[i]["MainInfo"] += " 车型:" + carHome.Vehicle; } } } return(dt); }
/// <summary> /// 分页查询 /// </summary> /// qiy 15.11.17 /// qiy 16.03.07 /// <param name="page">分页信息</param> /// <param name="filter">筛选条件</param> /// <returns></returns> public DataTable List(Models.Pagination page, NameValueCollection filter) { SqlCommand comm = DHelper.GetSqlCommand( @"SELECT tmp.rownum, ui.UI_ID, ui.Username, ui.RealName, ui.Email, ui.Mobile, ui.Status, dbo.Dic(2, ui.Status) AS StatusDesc, ui.RegisterDate, ui.Remarks, ur.UR_ID AS RoleId, ur.Name AS RoleName FROM USER_UserInfo AS ui RIGHT JOIN (SELECT TOP (@End) ROW_NUMBER() OVER (ORDER BY UI_ID DESC) AS rownum, UI_ID FROM USER_UserInfo WHERE (@RoleId IS NULL OR UI_ID IN (SElECT UI_ID FROM USER_Permissions WHERE RoleId = @RoleId)) AND (@RealName IS NULL OR RealName Like '%'+@RealName+'%') ) AS tmp ON ui.UI_ID = tmp.UI_ID LEFT JOIN USER_Relation AS ure ON ure.UserId = ui.UI_ID LEFT JOIN USER_Role AS ur ON ur.UR_ID = ure.RoleId WHERE tmp.rownum > @Begin " ); DHelper.AddParameter(comm, "@Begin", SqlDbType.Int, page.Begin); DHelper.AddParameter(comm, "@End", SqlDbType.Int, page.End); DHelper.AddParameter(comm, "@RoleId", SqlDbType.Int, filter["RoleId"]); DHelper.AddParameter(comm, "@RealName", SqlDbType.NVarChar, filter["RealName"]); SqlCommand commPage = DHelper.GetSqlCommand( @"SELECT COUNT(*) FROM USER_UserInfo WHERE (@RoleId IS NULL OR UI_ID IN (SElECT UI_ID FROM USER_Permissions WHERE RoleId = @RoleId)) AND (@RealName IS NULL OR RealName Like '%'+@RealName+'%') " ); DHelper.AddParameter(commPage, "@RoleId", SqlDbType.Int, filter["RoleId"]); DHelper.AddParameter(commPage, "@RealName", SqlDbType.NVarChar, filter["RealName"]); page.Total = Convert.ToInt32(DHelper.ExecuteScalar(commPage)); return(DHelper.ExecuteDataTable(comm)); }
internal static async Task <string> ExpressionEvaluatorAsync(string expressionString, string rootAliasUrl, dynamic Business, string queryString, Models.Pagination viewDetails, string view, Dictionary <string, dynamic> webactionsApiDictionary, Dictionary <string, dynamic> searchApiDictionary, Dictionary <string, long> functionalLog, string themeid, bool isCacheEnabled = false, bool isDetailsView = false, bool isNFSite = false, string developerId = null) { try { var expression = expressionString; expression = expression.ToLower(); var expressionArray = expression.Split('.'); dynamic dataObject = null; #region WEB ACTION if (expressionArray != null && expressionArray.Length > 0 && expressionArray[0].ToLower().Equals("webactions")) { var keyExists = functionalLog.ContainsKey("WEBACTIONS HANDLER"); long counter = 0; if (keyExists) { counter = functionalLog["WEBACTIONS HANDLER"]; } var count = 0; expressionArray = expressionString.Split('.'); var webactionwidget = expressionArray[1].Split('[')[0]; if (webactionsApiDictionary != null && webactionsApiDictionary.Count() > 0) { if (webactionsApiDictionary.ContainsKey(webactionwidget.ToLower())) { dataObject = webactionsApiDictionary[webactionwidget.ToLower()]; } } if (dataObject == null) { dataObject = await ApiHelper.GetWebActionsDataAsync(developerId, webactionwidget, isNFSite?Business.tag.Value : Business.websiteid.Value, themeid, isCacheEnabled); webactionsApiDictionary.Add(webactionwidget.ToLower(), dataObject); } if (dataObject != null) { var extraObject = dataObject["Extra"]; //dataObject = dataObject["Data"]; if (expressionArray.Length > 1) { expressionArray[1] = expressionArray[1].Replace(webactionwidget, "Data"); } foreach (var expressionValue in expressionArray) { if (count > 0) { var value = expressionValue.Trim('[', ']'); if (value.Contains("[")) { var dataElement = value.Split('['); dataObject = dataObject[dataElement[0]]; var index = dataElement[1].Replace("]", ""); int numValue; bool parsed = Int32.TryParse(index, out numValue); if (!parsed) { numValue = 0; } if (isDetailsView && !parsed) { dataObject = GetElementFromArray(dataObject, index, "_id", expression, viewDetails, isDetailsView, false, isNFSite); } else { dataObject = GetElementFromArray(dataObject, numValue.ToString(), "_id", expression, viewDetails, false, false, isNFSite); } } else { if (value.Contains("length")) { dataObject = extraObject["TotalCount"]; return(dataObject.ToString()); } else if (value.ToLower().Equals("replace")) { object tempDataObject = dataObject[value]; var type = tempDataObject.GetType(); if (type.Name.Equals("JValue")) { var tempString = value.Trim(')').Split('(')[1].Split(','); var pattern = tempString[0]; var valueString = tempString[1]; dataObject = GetReplacedValue(dataObject, pattern, valueString); } } else { object tempDataObject = dataObject[value]; var type = tempDataObject.GetType(); if (type.Name.Equals("JValue")) { dataObject = dataObject[value].Value; } else { dataObject = dataObject[value]; } } } } count++; } if (dataObject != null) { object tempDataObject = dataObject; var type = tempDataObject.GetType(); if (type.Name.Equals("JArray")) { return(dataObject.ToString()); } else if (type.Name.Equals("Double")) { return("" + dataObject + ""); } else if (type.Name.Equals("Int64")) { return("" + dataObject + ""); } else if (type.Name.Equals("Int32")) { return("" + dataObject + ""); } return("'" + WebUtility.HtmlEncode(dataObject.ToString()) + "'"); } else { return("''"); } } else { return("''"); } } #endregion #region NAVIGATION LINKS else if (expression.Contains("currentpagenumber")) { return(viewDetails.currentpagenumber); } else if (expression.Contains("previous") || expression.Contains("next")) { if (expression.Contains("previous")) { return("'" + WebUtility.HtmlEncode(viewDetails.prevpage.url) + "'"); } else { return("'" + WebUtility.HtmlEncode(viewDetails.nextpage.url) + "'"); } } #endregion #region BUSINESS HANDLER if (expressionArray != null && expressionArray.Length > 1) { var count = 0; foreach (var expressionValue in expressionArray) { var value = expressionValue.Trim().Trim('[').Trim(']'); if (value.ToLower().Contains("length")) { return(GetObjectSize(dataObject).ToString()); } else if (value.ToLower().Contains("substr")) { var index = value.IndexOf('('); return(dataObject + "." + value.Replace(value.Substring(0, index), value.Substring(0, index).ToLower())); } else { if (count != 0 && !value.ToLower().Contains("[")) { object tempDataObject = dataObject[value]; var type = tempDataObject.GetType(); if (type.Name.Equals("JValue")) { dataObject = dataObject[value].Value; } else { dataObject = dataObject[value]; } } else if (value.ToLower().Contains("[")) { var dataElement = value.ToLower().Split('['); dataObject = dataObject[dataElement[0]]; var index = dataElement[1].Replace("]", ""); int numValue; var detailValue = string.Empty; bool parsed = Int32.TryParse(index, out numValue); bool isDetailViewObject = false; if (!parsed) { isDetailViewObject = true; if (isDetailsView) { detailValue = viewDetails.currentpagenumber; } else { numValue = 0; detailValue = numValue.ToString(); } } else { detailValue = numValue.ToString(); } // change for details view dataObject = GetElementFromArray(dataObject, detailValue, queryString, expression, viewDetails, isDetailsView, isDetailViewObject, isNFSite); } else { if (Business[value] != null) { dataObject = Business[value]; } else { dataObject = Business; } } } count++; } if (dataObject != null) { object tempDataObject = dataObject; var type = tempDataObject.GetType(); if (type.Name.Equals("JArray")) { return(dataObject.ToString()); } else if (type.Name.Equals("Double")) { return("" + dataObject + ""); } else if (type.Name.Equals("Int64")) { return("" + dataObject + ""); } else if (type.Name.Equals("Int32")) { return("" + dataObject + ""); } return("'" + WebUtility.HtmlEncode(dataObject.ToString()) + "'"); } else { return("''"); } } #endregion } catch (Exception ex) { var x = ex.ToString(); var y = x; var z = y; } return("''"); }
/// <summary> /// Process nodes with k-script tags. /// </summary> public override void Process(ref HtmlNode node, HtmlAttribute dynamicAttribute, Dictionary <string, AliasReference> classNameAlias, Dictionary <int, string> classNameAliasdepth, int depth, string websiteId, ExpressionEvaluator evaluator, KEntity entity, dynamic websiteData, Models.Pagination viewDetails, string queryString, Dictionary <string, long> functionLog, bool isDetailsView = false, bool isNFSite = false, string developerId = null) { try { var apiUrl = node.GetAttributeValue("get-api", null); var input = node.GetAttributeValue("input", null); var headers = node.GetAttributeValue("headers", null)?.Trim()?.Trim('[')?.Trim(']'); string cacheEnabledStr = node.GetAttributeValue("cacheenabled", null); bool cacheEnabled = true; if (!string.IsNullOrEmpty(cacheEnabledStr)) { cacheEnabledStr = evaluator.EvaluateExpression(cacheEnabledStr, entity, viewDetails, classNameAlias, websiteData, websiteData?._system?.kresult, queryString, out bool hasData, functionLog, isDetailsView, isNFSite, developerId).ToString(); bool.TryParse(cacheEnabledStr, out cacheEnabled); } if (!string.IsNullOrEmpty(apiUrl)) { var tempUrl = apiUrl; var headerDict = new Dictionary <string, string>(); #region API ENDPOINT if (!string.IsNullOrEmpty(input)) { var tempInputArray = input.Split(','); var inputArray = input.Split(','); int count = 0; foreach (var elem in inputArray) { if (elem.Contains("]") || elem.Contains("[")) { var output = evaluator.EvaluateExpression(elem, entity, viewDetails, classNameAlias, websiteData, websiteData?._system?.kresult, queryString, out bool hasData, functionLog, isDetailsView, isNFSite, developerId).ToString(); node.SetAttributeValue("input", input.Replace(tempInputArray[count], output.Trim('\''))); tempUrl = tempUrl.Replace("{" + count + "}", output.Trim('\'')); } else { tempUrl = tempUrl.Replace("{" + count + "}", elem); } count++; } } node.SetAttributeValue("get-api", tempUrl); #endregion if (!string.IsNullOrEmpty(headers)) { var headersArray = Helper.TrimDelimiters(headers).Split(','); foreach (var header in headersArray) { var separator = header.Split(':'); if (!headerDict.ContainsKey(separator[0].Trim())) { headerDict.Add(separator[0].Trim().Trim('\''), separator[1].Trim().Trim('\'')); } } } var result = ApiHelper.GetResponseFromKScriptAsync(tempUrl, headerDict, cacheEnabled, websiteData?.rootaliasurl?.url?.Value, functionLog, websiteData?._id).GetAwaiter().GetResult(); //TODO: optimize this code if (result != null) { try { if (websiteData["_system"] == null) { websiteData["_system"] = new JObject(); } websiteData["_system"]["kresult"] = result; AliasReference aliasReference = new AliasReference { referenceObject = null, iteration = -1, maxIteration = -1 }; classNameAlias.Add("kresult", aliasReference); classNameAliasdepth.Add(depth, "kresult"); } catch { } try { node.Attributes.Remove("get-api"); node.Attributes.Remove("input"); node.Attributes.Remove("headers"); node.Attributes.Remove("cacheenabled"); } catch { } } } } catch (Exception ex) { } }
/// <summary> /// Process nodes with k-object tags. /// </summary> public override void Process(ref HtmlNode node, HtmlAttribute dynamicAttribute, Dictionary <string, AliasReference> classNameAlias, Dictionary <int, string> classNameAliasdepth, int depth, string websiteId, ExpressionEvaluator evaluator, KEntity entity, dynamic websiteData, Models.Pagination viewDetails, string queryString, Dictionary <string, long> functionLog, bool isDetailsView = false, bool isNFSite = false, string developerId = null) { Node result = LexerGenerator.Parse(Helper.TrimDelimiters(dynamicAttribute.Value).Trim('[').Trim(']')); if (result?.Children?.Count == 3) { string referenceName = result.Children[0].Children[0].Token.Value.ToLower(); string referenceObjectKey = result.Children[2].Children[0].Token.Value; AliasReference aliasReference = new AliasReference { referenceObject = referenceObjectKey, iteration = -1, maxIteration = -1 }; if (!classNameAlias.ContainsKey(referenceName)) { classNameAlias.Add(referenceName, aliasReference); } } }
/// <summary> /// 用户列表 /// </summary> /// qiy 15.11.17 /// <param name="page">分页信息</param> /// <param name="filter">筛选条件</param> /// <returns></returns> public DataTable List(Models.Pagination page, NameValueCollection filter) { return(userMapper.List(page, filter)); }
public override void Process(ref HtmlNode node, HtmlAttribute dynamicAttribute, Dictionary <string, AliasReference> classNameAlias, Dictionary <int, string> classNameAliasdepth, int depth, string websiteId, ExpressionEvaluator evaluator, KEntity entity, dynamic websiteData, Models.Pagination viewDetails, string queryString, Dictionary <string, long> functionLog, bool isDetailsView = false, bool isNFSite = false, string developerId = null) { if (Kitsune.Helper.Constants.WidgetRegulerExpression.IsMatch(dynamicAttribute.Value)) { string attributeValue = evaluator.EvaluateExpression(dynamicAttribute.Value, entity, viewDetails, classNameAlias, websiteData, websiteData?._system?.kresult, queryString, out bool hasData, functionLog, isDetailsView, isNFSite, developerId).ToString(); if (!hasData || (System.Boolean.TryParse(attributeValue, out bool attVal) && attVal)) { node = HtmlCommentNode.CreateNode("<!-- skip -->"); } } }
/// <summary> /// 分页查询 /// </summary> /// qiy 16.03.29 /// <param name="page">分页信息</param> /// <param name="filter">筛选条件</param> /// <returns></returns> public System.Data.DataTable List(Models.Pagination page, NameValueCollection filter) { return(partnerMapper.List(page, filter)); }
public override void Process(ref HtmlNode node, HtmlAttribute dynamicAttribute, Dictionary <string, AliasReference> classNameAlias, Dictionary <int, string> classNameAliasdepth, int depth, string websiteId, ExpressionEvaluator evaluator, KEntity entity, dynamic websiteData, Models.Pagination viewDetails, string queryString, Dictionary <string, long> functionLog, bool isDetailsView = false, bool isNFSite = false, string developerId = null) { Node result = LexerGenerator.Parse(Helper.TrimDelimiters(dynamicAttribute.Value)); if (result.Token.Value == ACTIONS.Loop) { string referenceObject = result.Children[0].Children[0].Token.Value; string referenceName = result.Children[2].Children[0].Token.Value?.ToLower(); var refObj = evaluator.EvaluateExpression(referenceObject, entity, viewDetails, classNameAlias, websiteData, websiteData?._system?.kresult, queryString, out bool hasData, functionLog, isDetailsView, isNFSite); if (refObj.GetType() == typeof(string) && refObj == "") { node = HtmlCommentNode.CreateNode("<!-- skip -->"); return; } string offsetObj = evaluator.EvaluateExpression(result.Children[6], entity, viewDetails, classNameAlias, websiteData, websiteData?._system?.kresult, queryString, out hasData, functionLog, isDetailsView, isNFSite, developerId).ToString(); int.TryParse(offsetObj, out int offset); int iteration = 0; int maxIteration = 0; if (dynamicAttribute.Value.IndexOf("offset") > 0) { if (int.TryParse(viewDetails.currentpagenumber, out int currentPage) && currentPage > 0) { iteration = offset * (currentPage - 1); } } else { string iterationObj = evaluator.EvaluateExpression(result.Children[4], entity, viewDetails, classNameAlias, websiteData, websiteData?._system?.kresult, queryString, out hasData, functionLog, isDetailsView, isNFSite, developerId).ToString(); int.TryParse(iterationObj, out iteration); } maxIteration = iteration + offset; int objSize = (int)evaluator.GetObjectSize(refObj); maxIteration = (maxIteration < objSize) ? maxIteration : objSize; if (iteration > maxIteration) { node = HtmlCommentNode.CreateNode("<!-- skip -->"); return; } else if (objSize == maxIteration && dynamicAttribute.Value.IndexOf("offset") > 0) { viewDetails.nextpage.url = "#"; viewDetails.pagesize = maxIteration - iteration + 1; } AliasReference aliasReference = new AliasReference { referenceObject = null, iteration = iteration, maxIteration = maxIteration }; if (!classNameAlias.ContainsKey(referenceName)) { classNameAlias.Add(referenceName, aliasReference); classNameAliasdepth.Add(depth, referenceName); } } else if (result.Token.Value == ACTIONS.InLoop) { string referenceName = result.Children[0].Children[0].Token.Value?.ToLower(); string referenceObject = result.Children[2].Children[0].Token.Value; var obj = evaluator.EvaluateExpression(referenceObject, entity, viewDetails, classNameAlias, websiteData, websiteData?._system?.kresult, queryString, out bool hasData, functionLog, isDetailsView, isNFSite); if (obj.GetType() == typeof(string) && obj == "") { node = HtmlCommentNode.CreateNode("<!-- skip -->"); return; } AliasReference aliasReference = new AliasReference(); aliasReference.referenceObject = referenceObject; aliasReference.iteration = 0; aliasReference.maxIteration = (int)evaluator.GetObjectSize(obj); if (!classNameAlias.ContainsKey(referenceName)) { classNameAlias.Add(referenceName, aliasReference); classNameAliasdepth.Add(depth, referenceName); } } }
private static async Task <object> GetObjectDetailsAsync(string[] expressionArray, dynamic business, string queryString, Models.Pagination viewDetails, string themeid, bool isCacheEnabled = false, bool isDetailsView = false, bool isNFSite = false, string developerId = null) { try { dynamic dataObject = null; if (expressionArray != null && expressionArray.Length > 0 && expressionArray[0].ToUpper().Equals("WEBACTIONS")) { var webactionwidget = expressionArray[1].Split('[')[0]; var webactionsdata = await ApiHelper.GetWebActionsDataAsync(developerId, webactionwidget, isNFSite?business.tag.Value : business.websiteid.Value, themeid, isCacheEnabled); if (webactionsdata != null) { return(webactionsdata.Data); } } else if (expressionArray != null && expressionArray.Length > 0) { var count = 0; foreach (var value in expressionArray) { if (count != 0) { if (value.Contains("[")) { var dataElement = value.ToLower().Split('['); dataObject = dataObject[dataElement[0]]; var index = dataElement[1].Replace("]", ""); int numValue; var detailValue = string.Empty; bool parsed = Int32.TryParse(index, out numValue); bool isDetailViewObject = false; if (!parsed) { isDetailViewObject = true; if (isDetailsView) { detailValue = viewDetails.currentpagenumber; } else { numValue = 0; detailValue = numValue.ToString(); } } else { detailValue = numValue.ToString(); } var tempExpression = string.Join(".", expressionArray); dataObject = DataHandler.GetElementFromArray(dataObject, detailValue, queryString, tempExpression, viewDetails, isDetailsView, isDetailViewObject, isNFSite); } else { dataObject = dataObject[value]; var tempData = (object)dataObject; if (tempData.GetType().Name.Equals("JValue")) { dataObject = dataObject.Value; } } } else { if (business.GetType() == typeof(Newtonsoft.Json.Linq.JObject) && ((Newtonsoft.Json.Linq.JObject)business).SelectToken(value) != null) { if (((Newtonsoft.Json.Linq.JObject)business).SelectToken(string.Join(".", expressionArray)) != null) { return(((Newtonsoft.Json.Linq.JObject)business).SelectToken(string.Join(".", expressionArray))); } dataObject = ((Newtonsoft.Json.Linq.JObject)business).SelectToken(value); } else { dataObject = business; } } count++; } } else { dataObject = expressionArray[0]; } return(dataObject); } catch (Exception ex) { } return(null); }
/// <summary> /// 查询已办列表 /// </summary> /// yand 15.11.27 /// qiy 16.04.29 重新实现 /// yand 16.07.25 添加主要信息筛选 /// <param name="page"></param> /// <param name="filters"></param> /// <returns></returns> public DataTable FindDoneList(Models.Pagination page, NameValueCollection filters) { SqlCommand comm = DHelper.GetSqlCommand(@" SELECT tmp.rownum,tmp.Name,tmp.PlateNo, tmp.VehicleKey,tmp.PlateNo,fi.InstanceId, fi.FlowId, fw.Name AS FlowName, fi.CurrentNode, fn.Name AS CurrentNodeName,fi.KeyXML, fi.CurrentUser, dbo.GetUser(fi.CurrentUser) AS CurrentUserName, fi.ProcessUser, dbo.GetUser(fi.ProcessUser) AS ProcessUserName, fi.ProcessTime, fi.StartUser, dbo.GetUser(fi.StartUser) AS StartUserName, fi.StartTime, fi.EndTime, fi.Status, dbo.Dic(9, fi.Status) AS StatusDesc FROM FLOW_Instance AS fi RIGHT JOIN ( SELECT TOP(@End) ROW_NUMBER() OVER(ORDER BY InstanceId DESC) AS rownum, InstanceId,fai.Name,fvi.PlateNo, fvi.VehicleKey FROM FLOW_Instance AS fi LEFT JOIN FANC_ApplicantInfo AS fai ON fai.FinanceId = fi.KeyXML.value('FinanceId[1]', 'Int') LEFT JOIN FANC_VehicleInfo AS fvi ON fvi .FinanceId =fai.FinanceId WHERE InstanceId IN(SELECT InstanceId FROM FLOW_Log WHERE ProcessUser = @CurrentUser) AND (fai.Type IS NULL OR fai.Type=1) AND (@MainInfo IS NULL OR (fai.Name LIKE '%'+ @MainInfo+'%'OR fvi.PlateNo LIKE '%'+ @MainInfo+'%')) AND(@FlowId IS NULL OR FlowId = @FlowId) AND(@CurrentNode IS NULL OR CurrentNode = @CurrentNode) AND(@BeginTime IS NULL OR DATEDIFF(day, StartTime, @BeginTime) <= 0) AND(@EndTime IS NULL OR DATEDIFF(day, StartTime, @EndTime) >= 0) AND(@Status IS NULL OR Status = @Status) ) AS tmp ON fi.InstanceId = tmp.InstanceId LEFT JOIN FLOW_WorkFlow AS fw ON fi.FlowId = fw.FlowId LEFT JOIN FLOW_Node AS fn ON fi.CurrentNode = fn.NodeId WHERE tmp.rownum > @Begin "); DHelper.AddParameter(comm, "@Begin", SqlDbType.Int, page.Begin); DHelper.AddParameter(comm, "@End", SqlDbType.Int, page.End); DHelper.AddInParameter(comm, "@FlowId", SqlDbType.Int, filters["FlowId"]); DHelper.AddInParameter(comm, "@CurrentNode", SqlDbType.Int, filters["CurrentNode"]); DHelper.AddInParameter(comm, "@CurrentUser", SqlDbType.Int, filters["CurrentUser"]); DHelper.AddInParameter(comm, "@BeginTime", SqlDbType.DateTime, filters["BeginTime"]); DHelper.AddInParameter(comm, "@EndTime", SqlDbType.DateTime, filters["EndTime"]); DHelper.AddInParameter(comm, "@Status", SqlDbType.TinyInt, filters["Status"]); DHelper.AddInParameter(comm, "@MainInfo", SqlDbType.NVarChar, filters["MainInfo"]); SqlCommand commPage = DHelper.GetSqlCommand(@" SELECT COUNT(*) FROM FLOW_Instance as fi LEFT JOIN FANC_ApplicantInfo AS fai ON fai.FinanceId = fi.KeyXML.value('FinanceId[1]', 'Int') LEFT JOIN FANC_VehicleInfo AS fvi ON fvi .FinanceId =fai.FinanceId WHERE InstanceId IN(SELECT InstanceId FROM FLOW_Log WHERE ProcessUser = @CurrentUser) AND (fai.Type IS NULL OR fai.Type=1) AND (@MainInfo IS NULL OR (fai.Name LIKE '%'+ @MainInfo+'%'OR fvi.PlateNo LIKE '%'+ @MainInfo+'%')) AND(@FlowId IS NULL OR FlowId = @FlowId) AND(@CurrentNode IS NULL OR CurrentNode = @CurrentNode) AND(@BeginTime IS NULL OR DATEDIFF(day, StartTime, @BeginTime) <= 0) AND(@EndTime IS NULL OR DATEDIFF(day, StartTime, @EndTime) >= 0) AND(@Status IS NULL OR Status = @Status) " ); DHelper.AddInParameter(commPage, "@FlowId", SqlDbType.Int, filters["FlowId"]); DHelper.AddInParameter(commPage, "@CurrentNode", SqlDbType.Int, filters["CurrentNode"]); DHelper.AddInParameter(commPage, "@CurrentUser", SqlDbType.Int, filters["CurrentUser"]); DHelper.AddInParameter(commPage, "@BeginTime", SqlDbType.DateTime, filters["BeginTime"]); DHelper.AddInParameter(commPage, "@EndTime", SqlDbType.DateTime, filters["EndTime"]); DHelper.AddInParameter(commPage, "@Status", SqlDbType.TinyInt, filters["Status"]); DHelper.AddInParameter(commPage, "@MainInfo", SqlDbType.NVarChar, filters["MainInfo"]); page.Total = Convert.ToInt32(DHelper.ExecuteScalar(commPage)); return(DHelper.ExecuteDataTable(comm)); }
public override void Process(ref HtmlNode node, HtmlAttribute dynamicAttribute, Dictionary <string, AliasReference> classNameAlias, Dictionary <int, string> classNameAliasdepth, int depth, string websiteId, ExpressionEvaluator evaluator, KEntity entity, dynamic websiteData, Models.Pagination viewDetails, string queryString, Dictionary <string, long> functionLog, bool isDetailsView = false, bool isNFSite = false, string developerId = null) { }
public IActionResult GetList([FromBody] dynamic userFilter) { Util.Return.ReturnValue <Models.Pagination <Models.User.UserInfoViewModel> > returnValue = new Util.Return.ReturnValue <Models.Pagination <Models.User.UserInfoViewModel> >(); try { Models.User.UserFilterViewModel userFilterViewModel = Newtonsoft.Json.JsonConvert.DeserializeObject <Models.User.UserFilterViewModel>( userFilter.ToString()); Models.Pagination <Models.User.UserInfoViewModel> pagination = new Models.Pagination <Models.User.UserInfoViewModel>() { CurrentPageIndex = userFilterViewModel.CurrentPageIndex , PageSize = userFilterViewModel.PageSize }; DataBll.User.UserInfoDataBll userInfoDataBll = new DataBll.User.UserInfoDataBll(); Int32 totalRow; IList <UserInfo> users; (totalRow, users) = userInfoDataBll.Query( userFilterViewModel.UserName?.Trim() , userFilterViewModel.State.HasValue ? (Int32)userFilterViewModel.State.Value : 0 , userFilterViewModel.CurrentPageIndex, userFilterViewModel.PageSize); if (null != users && users.Count > 0) { IList <Models.User.UserInfoViewModel> userViewModels = users.Select( x => new Models.User.UserInfoViewModel() { Code = x.Code , CreateTime = x.CreateTime.AddHours(8).ToString("yyyy-MM-dd HH:mm:ss") , Creator = x.Creator , Description = x.Description , Id = x.ID //, LastUpdateTime = x.LastUpdateTime //, LastUpdator = x.LastUpdator , Remark = x.Remark , State = x.State.ToString() , UserName = x.UserName } ).ToList(); pagination.Data = userViewModels; } pagination.TotalRow = totalRow; returnValue.Value = pagination; returnValue.IsOperateSuccess = true; returnValue.Description = "Success"; } catch (Exception ex) { returnValue.IsOperateSuccess = false; returnValue.Description = $"Happened a error in server.The error message is {ex.Message}"; ProcessException(returnValue.Description, ex); } return(new JsonResult(returnValue)); }
internal static async Task <string> ReplaceWidgetDataAsync(string rootAliasUri, bool isCacheEnabled, HtmlNode documentNode, List <string> lines, dynamic fpModel, string themeid, string queryString, Models.Pagination viewDetails, string view = null, Dictionary <string, long> functionLog = null, bool isDetailsView = false, bool isNFSite = false) { try { var exceptionWidget = string.Empty; var webactionsApiDictionary = new Dictionary <string, dynamic>(); var searchApiDictionary = new Dictionary <string, dynamic>(); var functionStopWatch = new Stopwatch(); for (int index = 0; index < lines.Count; index++) { var line = lines[index]; var attributeValue = HtmlHelper.GetExpressionFromElement(line, index); if (attributeValue != null && attributeValue.Any()) { foreach (var attr in attributeValue) //Parallel.ForEach(attributeValue, attr => { if (!ignoreTags.Contains(attr.Value)) { var expression = string.Empty; var tempVal = attr.Value; var tempMatch = attr.Value.Trim('[', ']'); var matches = Parser.GetObjects(tempMatch); //foreach (var mat in matches) //Parallel.ForEach(matches, mat => for (int i = 0; i < matches.Count; i++) { var mat = matches[i]; expression = mat.ToString().Replace("[[", "").Replace("]]", ""); var expressionValue = await ExpressionEvaluatorAsync(expression, rootAliasUri, fpModel, queryString, viewDetails, view, webactionsApiDictionary, searchApiDictionary, functionLog, themeid, isCacheEnabled, isDetailsView, isNFSite); tempVal = ReplaceFirstOccurrence(tempVal, expression, expressionValue); } //); var expressionValue2 = !string.IsNullOrEmpty(tempVal.Trim('[', ']')) ? Parser.Execute(tempVal.Trim('[', ']')) : ""; line = ReplaceFirstOccurrence(line, attr.Value, WebUtility.HtmlDecode(expressionValue2?.ToString())); lines[index] = line; } } //); } } var newDocument = new HtmlDocument(); newDocument.LoadHtml(string.Join("\n", lines.ToArray())); functionStopWatch.Start(); List <HtmlNode> widgetsToRemove = new List <HtmlNode>(); foreach (var kshowWidget in newDocument.DocumentNode.Descendants().Where(x => x.Attributes["k-show"] != null && !string.IsNullOrEmpty(x.Attributes["k-show"].Value))) { if (KSelectHandle(rootAliasUri, newDocument.DocumentNode, kshowWidget, fpModel)) { widgetsToRemove.Add(kshowWidget); } } foreach (var khideWidget in newDocument.DocumentNode.Descendants().Where(x => x.Attributes["k-hide"] != null && !string.IsNullOrEmpty(x.Attributes["k-hide"].Value))) { if (!KSelectHandle(rootAliasUri, newDocument.DocumentNode, khideWidget, fpModel)) { widgetsToRemove.Add(khideWidget); } } if (widgetsToRemove.Any()) { for (int i = 0; i < widgetsToRemove.Count; i++) { widgetsToRemove[i].ParentNode.RemoveChild(widgetsToRemove[i]); } } if (functionLog != null) { functionLog.Add("K SHOW LOGIC", functionStopWatch.ElapsedMilliseconds); } functionStopWatch.Reset(); var attrList = newDocument.DocumentNode.SelectNodes("//*/@*[starts-with(local-name(), 'k-')]"); if (attrList != null && attrList.Count() > 0) { foreach (var tempNode in attrList) { var attrName = new List <String>(); foreach (var attr in tempNode.Attributes) { if (!attr.Name.StartsWith("k-pay", StringComparison.InvariantCultureIgnoreCase) && attr.Name.StartsWith("k-")) { attrName.Add(attr.Name); } } foreach (var attr in attrName) { tempNode.Attributes.Remove(attr); } } } var htmlString = newDocument.DocumentNode.OuterHtml; return(htmlString); } catch (Exception ex) { } return(null); }
public override void Process(ref HtmlNode node, HtmlAttribute dynamicAttribute, Dictionary <string, AliasReference> classNameAlias, Dictionary <int, string> classNameAliasdepth, int depth, string websiteId, ExpressionEvaluator evaluator, KEntity entity, dynamic websiteData, Models.Pagination viewDetails, string queryString, Dictionary <string, long> functionLog, bool isDetailsView = false, bool isNFSite = false, string developerId = null) { List <string> amountList = new List <string>(); string amount = Helper.TrimDelimiters(dynamicAttribute.Value); amount = evaluator.EvaluateExpression(amount, entity, viewDetails, classNameAlias, websiteData, websiteData?._system?.kresult, queryString, out bool hasData, functionLog, isDetailsView, isNFSite, developerId)?.ToString(); dynamicAttribute.Value = amount; amountList.Add(amount); var checkSumAPIResponse = ApiHelper.GetKPayEncodedCheckSum(websiteId, amountList); amountList = checkSumAPIResponse.amounts; List <string> checkSumList = checkSumAPIResponse.checksums; node.SetAttributeValue("k-pay-checksum", checkSumList[0]); }
public ActionResult Add1(Models.Pagination page) { _pagination.AddEntry1(page); return(RedirectToAction("Tmp")); }
public ActionResult Delete(Models.Pagination page) { _pagination.DeleteEntry(page); return(RedirectToAction("Tmp")); }
public ActionResult Get([FromBody] Models.Pagination pagination) { return(View()); }
internal static object GetElementFromArray(dynamic arrrayObject, string elementIndex, string queryString, string expression, Models.Pagination viewDetails, bool isDetailsView = false, bool isDetailsViewObject = false, bool isNFSite = false) { try { if (isNFSite && isDetailsView && isDetailsViewObject && (expression.Contains(".products") || expression.Contains(".updates") || expression.Contains(".offers") || expression.Contains("custompages")) && viewDetails.currentpagenumber.Equals(elementIndex.ToString())) { if (expression.Contains("products")) { return(GetProductDetailsObject(arrrayObject, elementIndex)); } else if (expression.Contains("updates")) { return(GetUpdateDetailsObject(arrrayObject, elementIndex)); } else if (expression.Contains("offers")) { return(GetOfferDetailsObject(arrrayObject, elementIndex)); } else if (expression.Contains("custompages")) { return(GetCustomPagesDetailsObject(arrrayObject, elementIndex)); } } else if (isDetailsView && expression.ToLower().Contains("webactions") && (expression.Contains("[i]") || expression.Contains("[k_obj_ind]"))) { return(GetWebActionDetailsObject(arrrayObject, viewDetails.currentpagenumber)); } object arrayObject = arrrayObject; if (arrayObject != null) { try { try { return(((dynamic)arrayObject)["_" + elementIndex]); } catch (RuntimeBinderException) { var valueExist = DynamicFieldExists(arrayObject, Convert.ToInt32(elementIndex)); if (valueExist) { return(GetValueFromArray(arrayObject, Convert.ToInt32(elementIndex))); } } } catch (Exception ex1) { try { return(GetDetailsObjectFromArray(arrrayObject, elementIndex, queryString)); } catch (Exception ex2) { throw ex2; } throw ex1; } } //if (isDetailsView && isDetailsViewObject && (expression.Contains(".products") || expression.Contains(".updates") || expression.Contains(".offers") || expression.Contains("custompages")) && viewDetails.currentpagenumber.Equals(elementIndex.ToString())) //{ // if (expression.Contains("products")) // { // return GetProductDetailsObject(arrrayObject, elementIndex); // } // else if (expression.Contains("updates")) // { // return GetUpdateDetailsObject(arrrayObject, elementIndex); // } // else if (expression.Contains("offers")) // { // return GetOfferDetailsObject(arrrayObject, elementIndex); // } // else if (expression.Contains("custompages")) // { // return GetCustomPagesDetailsObject(arrrayObject, elementIndex); // } // if (!String.IsNullOrEmpty(queryString)) // { // return GetDetailsObjectFromArray(arrrayObject, elementIndex, queryString); // } //} //else if (isDetailsView && expression.ToLower().Contains("webactions") && expression.Contains("[i]")) //{ // return GetWebActionDetailsObject(arrrayObject, viewDetails.currentpagenumber); //} //object arrayObject = arrrayObject; //if (arrayObject != null) //{ // var valueExist = DynamicFieldExists(arrayObject, Convert.ToInt32(elementIndex)); // if (valueExist) // { // return GetValueFromArray(arrayObject, Convert.ToInt32(elementIndex)); // } //} } catch (Exception ex) { var x = ex; var y = x; var z = y; } return(null); }
public void ProcessNode(ref HtmlNode node, HtmlAttribute dynamicAttribute, Dictionary <string, AliasReference> classNameAlias, Dictionary <int, string> classNameAliasdepth, int depth, string websiteId, ExpressionEvaluator evaluator, KEntity entity, dynamic websiteData, Models.Pagination viewDetails, string queryString, Dictionary <string, long> functionLog, bool isDetailsView = false, bool isNFSite = false, string developerId = null) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); Process(ref node, dynamicAttribute, classNameAlias, classNameAliasdepth, depth, websiteId, evaluator, entity, websiteData, viewDetails, queryString, functionLog, isDetailsView, isNFSite); stopwatch.Stop(); Helper.UpdateFunctionLog(functionLog, TagProcessorIdentifier, stopwatch.ElapsedMilliseconds); }
internal static async Task RepeatHtmlNodesAsync(HtmlNode documentNode, dynamic business, string queryString, string rootAliasUrl, string[] urlParams, Models.Pagination viewDetails, string themeid, bool isCacheEnabled = false, bool isDetailsView = false, bool isKScriptRepeat = false, bool isNFSite = false, string developerId = null) { try { var repeatNodeList = documentNode.DescendantsAndSelf().Where(s => s.Attributes["k-Repeat"] != null).ToList(); var removeNodeList = new List <HtmlNode>(); for (var i = 0; i < repeatNodeList.Count; i++) { removeNodeList.AddRange(repeatNodeList[i].Descendants().Where(x => x.Attributes["k-Repeat"] != null)); } if (removeNodeList.Any()) { foreach (var node in removeNodeList) { repeatNodeList.Remove(node); } } if (!isKScriptRepeat) { removeNodeList = new List <HtmlNode>(); for (var i = 0; i < repeatNodeList.Count; i++) { try { if (repeatNodeList[i].GetAttributeValue("k-Repeat", null).Trim('[', ']').ToLower().StartsWith("kresult")) { removeNodeList.Add(repeatNodeList[i]); } } catch { } } if (removeNodeList.Any()) { foreach (var node in removeNodeList) { repeatNodeList.Remove(node); } } } if (repeatNodeList != null && repeatNodeList.Count() > 0) { foreach (var repeatNode in repeatNodeList) { //Putting try for each k-repeat node... in case of any exception in any k-repeat it should not impact other k-repeat try { var expression = repeatNode.GetAttributeValue("k-Repeat", null); repeatNode.Attributes.Remove("k-repeat"); expression = expression.Trim('[', ']'); int expressionNumber; var isNumeric = int.TryParse(expression, out expressionNumber); var repeatCount = 1; if (isNumeric) { RepeatNodeWithNoVerb(repeatNode, expressionNumber); } else if (!expression.Contains(',')) { var expressionValues = expression.Split(new string[] { "in " }, StringSplitOptions.None); var expressionArray = expressionValues[1].Split('.'); var dataObject = await GetObjectDetailsAsync(expressionArray, business, queryString, viewDetails, themeid, isCacheEnabled, isDetailsView, isNFSite, developerId); var objectLength = DataHandler.GetObjectSize(dataObject); if (expressionValues.Length == 2) { repeatCount = Convert.ToInt32(objectLength); RepeatNodesWithObject(repeatNode, repeatCount, expressionValues[1], expressionValues[0].Trim()); } } else { var expressionValues = expression.Split(','); var expressionArray = expressionValues[0].Split('.'); object dataObject = null; long objectLength = 0; dataObject = await GetObjectDetailsAsync(expressionArray, business, queryString, viewDetails, themeid, isCacheEnabled, isDetailsView, isNFSite, developerId); objectLength = DataHandler.GetObjectSize(dataObject); var verb = expressionValues[1].Trim(); var indexes = expressionValues[2].Split(':'); var firstIndex = indexes[0]; var finalIndex = indexes[1]; bool isPaginationView = false; //Check for the current view offset. if (firstIndex.ToLower().Contains("offset")) { var offset = viewDetails.currentpagenumber; int numValue = 0; bool parsed = Int32.TryParse(offset, out numValue); if (parsed) { isPaginationView = true; firstIndex = (numValue - 1).ToString(); } else { firstIndex = "0"; } } else { var firstIndexValue = await EvaluateRepeatCountAsync(firstIndex, rootAliasUrl, business, queryString, viewDetails, themeid, isCacheEnabled, isDetailsView, isNFSite, developerId); firstIndex = firstIndexValue?.ToString(); } //Evaluate repeat count and index var finalIndexValue = await EvaluateRepeatCountAsync(finalIndex, rootAliasUrl, business, queryString, viewDetails, themeid, isCacheEnabled, isDetailsView, isNFSite, developerId).ToString(); finalIndex = finalIndexValue?.ToString(); if (Convert.ToInt32(firstIndex) <= objectLength) { int firstIndexNum = Convert.ToInt32(firstIndex); int finalIndexNum = 0; bool parsed = Int32.TryParse(finalIndex, out finalIndexNum); if (isPaginationView) { firstIndexNum = firstIndexNum * finalIndexNum; if (objectLength <= (firstIndexNum + finalIndexNum)) { viewDetails.nextpage.url = "#"; } viewDetails.pagesize = finalIndexNum; } if (!parsed) { finalIndexNum = Convert.ToInt32(objectLength); } else { finalIndexNum = Convert.ToInt32(objectLength) > (firstIndexNum + finalIndexNum) ? finalIndexNum : (Convert.ToInt32(objectLength) - firstIndexNum); } RepeatNodesWithIndex(repeatNode, Convert.ToInt32(finalIndexNum), verb, firstIndexNum); if (repeatNode.Descendants().Any(x => x.Attributes["k-repeat"] != null)) { foreach (var node in repeatNode.Descendants().Where(s => s.Attributes["k-Repeat"] != null)) { RepeatHtmlNodesAsync(node, business, queryString, rootAliasUrl, urlParams, viewDetails, themeid, isCacheEnabled, isDetailsView, false, isNFSite, developerId); } } } } } catch (Exception ex) { } } } } catch (Exception ex) { } }
private static async Task <object> EvaluateRepeatCountAsync(string repeatIndex, string rootAliasUrl, dynamic business, string queryString, Models.Pagination viewDetails, string themeid, bool isCacheEnabled = false, bool isDetailsView = false, bool isNFSite = false, string developerId = null) { var webactionsApiDictionary = new Dictionary <string, dynamic>(); var functionLog = new Dictionary <string, long>(); var searchApiDictionary = new Dictionary <string, dynamic>(); var expression = string.Empty; var matches = Parser.GetObjects(repeatIndex); var tempVal = repeatIndex; foreach (var mat in matches) { expression = mat.ToString().Replace("[[", "").Replace("]]", ""); var expressionValue = await DataHandler.ExpressionEvaluatorAsync(expression, rootAliasUrl, business, queryString, viewDetails, "", webactionsApiDictionary, searchApiDictionary, functionLog, themeid, isCacheEnabled, isDetailsView, isNFSite, developerId); tempVal = DataHandler.ReplaceFirstOccurrence(tempVal, expression, expressionValue); } var expressionValue2 = !string.IsNullOrEmpty(tempVal.Trim('[', ']')) ? Parser.Execute(tempVal.Trim('[', ']')) : ""; return(expressionValue2); }
/// <summary> /// GetElement from array /// </summary> /// <param name="arrrayObject"></param> /// <param name="elementIndex"></param> /// <param name="queryString"></param> /// <param name="expression"></param> /// <param name="viewDetails"></param> /// <param name="isDetailsView"></param> /// <param name="isDetailsViewObject"></param> /// <returns></returns> private object GetElementFromArray(dynamic arrrayObject, string elementIndex, string queryString, string expression, Models.Pagination viewDetails, bool isDetailsView, bool isDetailsViewObject, bool isNFSite) { try { if (isNFSite && isDetailsView && isDetailsViewObject && (expression.Contains(".products") || expression.Contains(".updates") || expression.Contains(".offers") || expression.Contains("custompages")) && viewDetails.currentpagenumber.Equals(elementIndex.ToString())) { if (expression.Contains("products")) { return(GetProductDetailsObject(arrrayObject, elementIndex)); } else if (expression.Contains("updates")) { return(GetUpdateDetailsObject(arrrayObject, elementIndex)); } else if (expression.Contains("offers")) { return(GetOfferDetailsObject(arrrayObject, elementIndex)); } else if (expression.Contains("custompages")) { return(GetCustomPagesDetailsObject(arrrayObject, elementIndex)); } } else if (isDetailsView && expression.ToLower().Contains("webactions") && (expression.Contains("[i]") || expression.Contains("[k_obj_ind]"))) { return(GetWebActionDetailsObject(arrrayObject, viewDetails.currentpagenumber)); } try { if (arrrayObject != null) { return(GetValueFromArray(arrrayObject, elementIndex)); } } catch { try { return(GetDetailsObjectFromArray(arrrayObject, elementIndex, queryString)); } catch (Exception ex2) { throw ex2; } } } catch { } return(null); }