Exemplo n.º 1
0
        /// <summary>
        /// 
        /// Description: 得到返回内容
        /// Author:Liudpc
        /// Create Date: 2010-8-23 17:53:55
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public static WebEntity.WidgetResponseWWE GetResponse(WebEntity.WidgetRequestWWE req, Dictionary<int, SrnprWeb.WebEntity.WidgetProcessWWE> dic)
        {
            WebEntity.WidgetResponseWWE res=new SrnprWeb.WebEntity.WidgetResponseWWE();
            res.RQ = new List<SrnprWeb.WebInterface.WidgetRequestWWI>();
            res.RS = new List<SrnprWeb.WebInterface.WidgetResponseWWI>();

            for (int i=0,j= req.RQ.Count;i<j;i++)
            {
                switch (req.RQ[i].WidgetType)
                {
                    case "LS":

                        res.RS.Add(LSW.GetResponse(req.RQ[i],dic.ContainsKey(i)?dic[i]:null));
                        res.RQ.Add(req.RQ[i]);

                        break;

                    case "GS":
                        res.RS.Add(GSW.GetResponse(req.RQ[i], dic.ContainsKey(i) ? dic[i] : null));
                        res.RQ.Add(req.RQ[i]);
                        break;

                }

            }

            return res;
        }
Exemplo n.º 2
0
 public SPOWebPipeBind()
 {
     _id = Guid.Empty;
     _url = string.Empty;
     _spOnlineWeb = null;
     _web = null;
 }
Exemplo n.º 3
0
 public SPOWebPipeBind()
 {
     _id          = Guid.Empty;
     _url         = string.Empty;
     _spOnlineWeb = null;
     _web         = null;
 }
Exemplo n.º 4
0
        public static string GetShowHtml(WebEntity.PageShowWWE psw, string sId)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(psw.Content);

            return sb.ToString();
        }
        public static WebEntity Run([IoTHubTrigger("messages/events", Connection = "IotHub", ConsumerGroup = "table")] EventData message, ILogger log)
        {
            log.LogInformation($"PAYLOAD IN: {Encoding.UTF8.GetString(message.Body.Array)}");

            var payload = JsonConvert.DeserializeObject <Messages>(Encoding.UTF8.GetString(message.Body.Array));
            var webObj  = new WebEntity();

            webObj.PartitionKey = payload.type;
            webObj.RowKey       = Guid.NewGuid().ToString();
            webObj.DeviceId     = payload.deviceId;
            webObj.Created      = payload.ts;
            if (payload.type == "distance")
            {
                webObj.Distance = payload.data;
                return(webObj);
            }
            if (payload.type == "dht")
            {
                webObj.Temperature = payload.temperature;
                webObj.Humidity    = payload.humidity;
                return(webObj);
            }
            return(null);
        }
 public void SetWebEntityGridValues(WebEntity item, DataRow dr)
 {
     item.TotalRecords = Utils.GetDataRowValue(dr, PagedStoredProcedure.COL_TOTAL_REGISTROS, 0);
 }
Exemplo n.º 7
0
 public SPOWebPipeBind(WebEntity onlineWeb)
 {
     this._spOnlineWeb = onlineWeb;
 }
Exemplo n.º 8
0
 public WebEntityModel(WebEntity webEntity)
 {
     Description = webEntity.Description;
     Score       = webEntity.Score;
     EntityId    = webEntity.EntityId;
 }
Exemplo n.º 9
0
 public static void SaveList(WebEntity.PageShowListWWE gsl)
 {
     SrnprCommon.CommonFunction.EntitySerializerCCF<WebEntity.PageShowListWWE>.EntityToXml(gsl, sFilePath + PageShowList);
 }
Exemplo n.º 10
0
 public static void SaveFileByEntity(WebEntity.PageShowWWE psw)
 {
     SrnprCommon.CommonFunction.EntitySerializerCCF<WebEntity.PageShowWWE>.EntityToXml(psw, sFilePath + string.Format(sFileExt, psw.Id));
 }
Exemplo n.º 11
0
 public SPOWebPipeBind(WebEntity onlineWeb)
 {
     this._spOnlineWeb = onlineWeb;
 }
Exemplo n.º 12
0
        public GridShowResponseWWE GetHtmlByEntity(WebEntity.GridShowWWE gsw, GridShowRequestWWE request, WidgetProcessWWE pro)
        {
            GridShowResponseWWE response = new GridShowResponseWWE();
            response.Request = request;

            if (gsw != null)
            {
                if (request.ShowColumn == null)
                {
                    request.ShowColumn = new List<GridShowColumnBaseWWE>();

                    foreach (var t in gsw.ColumnList)
                    {

                            request.ShowColumn.Add(new GridShowColumnBaseWWE() { Guid = t.Guid, HeaderText = t.HeaderText, OrderType = t.OrderType, ShowDisplay = t.ShowDisplay });

                    }
                }

                DataTable dt = new DataTable();

                if (request.ProcessType == "" || request.ProcessType == "server")
                {

                    //开始分析排序依据

                    if (pro != null && pro.DataInfo != null&&pro.DataFlag)
                    {
                        dt = GetDataByTable(gsw, request,pro);
                    }
                    else
                    {
                        dt = GetDataByEntity(gsw, request);
                    }

                    StringBuilder sb = new StringBuilder();

                    sb.Append("");

                    //定义显示
                    Dictionary<string, string> dShow = new Dictionary<string, string>();

                    Dictionary<string, string> dOrder = new Dictionary<string, string>();

                    if (request.ShowColumn.Count > 0)
                    {

                        for (int i = 0, j = request.ShowColumn.Count; i < j; i++)
                        {
                            dShow.Add(request.ShowColumn[i].Guid, request.ShowColumn[i].ShowDisplay);
                            dOrder.Add(request.ShowColumn[i].Guid, request.ShowColumn[i].OrderType);
                        }

                    }

                    int iColumnCount = gsw.ColumnList.Count;

                    if (iColumnCount > 0)
                    {

                        sb.Append("<tr>");
                        for (int i = 0; i < iColumnCount; i++)
                        {

                                bool bIsOrder = string.IsNullOrEmpty(ReckeckOrderColumn(gsw.ColumnList[i].ColumnData));

                                var vSort = request.ShowColumn.SingleOrDefault(t => t.Guid == gsw.ColumnList[i].Guid);

                                string sOrderType = string.IsNullOrEmpty(vSort.OrderType) ? "d" : vSort.OrderType; ;

                                if (string.IsNullOrEmpty(ReckeckOrderColumn(gsw.ColumnList[i].ColumnData)))
                                {
                                    sOrderType = "n";
                                }

                                string sSortVisgn = "";

                                string sSortFunction = WebProcess.WidgetProcessWWP.SwwJsBaseName("GS.Sort", true, request.Guid, vSort.Guid);

                                switch (sOrderType)
                                {
                                    case "d":
                                        sSortVisgn = " <a href=\"javascript:" + sSortFunction + "\"> " + vSort.HeaderText + "</a>";
                                        break;
                                    case "a":
                                        sSortVisgn = " <a href=\"javascript:" + sSortFunction + "\"> " + vSort.HeaderText + "</a>↑";
                                        break;
                                    case "e":
                                        sSortVisgn = " <a href=\"javascript:" + sSortFunction + "\"> " + vSort.HeaderText + "</a>↓";
                                        break;
                                    case "n":
                                    default:
                                        sSortVisgn = vSort.HeaderText;
                                        break;
                                }

                                sb.Append("<th class=\"SWW_CSS_GS_TABLE_" + sOrderType + (dShow[gsw.ColumnList[i].Guid] == "d" ? "" : " SWW_CSS_GS_DisplayNone") + "\" " + (string.IsNullOrEmpty(gsw.ColumnList[i].Width) ? "" : gsw.ColumnList[i].Width) + " >" + sSortVisgn + "</th>");

                        }
                        sb.Append("</tr>");

                        /*
                        response.DataItem = new List<List<string>>();
                        for (int i = 0, j = dt.Rows.Count; i < j; i++)
                        {
                            response.DataItem.Add(new List<string>());

                            for (int n = 0; n < iColumnCount; n++)
                            {
                                response.DataItem[i].Add(dt.Rows[i][n].ToString().Trim());
                            }

                        }
                        */

                        for (int i = 0, j = dt.Rows.Count; i < j; i++)
                        {

                            sb.Append("<tr class=\"SWW_CSS_GS_TR_"+(i%2)+"\">");
                            for (int n = 0; n < iColumnCount; n++)
                            {

                                sb.Append("<td " + (dShow[gsw.ColumnList[n].Guid] == "d" ? "" : " class=\"SWW_CSS_GS_DisplayNone\" ") + (gsw.ColumnList[n].Style == "" ? "" : "style=\"" + gsw.ColumnList[n].Style + "\"") + ">");

                                    if (!string.IsNullOrEmpty(gsw.ColumnList[n].ColumnData))
                                    {

                                        string sData = RecheckColumnName(gsw.ColumnList[n].ColumnData);

                                        switch (gsw.ColumnList[n].ColumnType)
                                        {
                                            case "r":
                                                sb.Append("<input type=\"radio\" name=\"" + request.ClientId + "_column_" + gsw.ColumnList[n].Guid + "\" value=\"" + dt.Rows[i][sData].ToString().Trim() + "\" />" + GetDataRowReplace(gsw.ColumnList[n].ColumnShow, dt.Rows[i]));
                                                break;
                                            case "c":
                                                sb.Append("<input type=\"checkbox\" name=\"" + request.ClientId + "_column_" + gsw.ColumnList[n].Guid + "\" value=\"" + dt.Rows[i][sData].ToString().Trim() + "\" />" + GetDataRowReplace(gsw.ColumnList[n].ColumnShow, dt.Rows[i]));
                                                break;
                                            case "l":
                                                sb.Append("<a href=\"" + GetDataRowReplace(gsw.ColumnList[n].ColumnShow, dt.Rows[i]).Replace("[this]", dt.Rows[i][sData].ToString().Trim()) + "\">" + dt.Rows[i][sData].ToString().Trim() + "</a>");
                                                break;
                                            case "d":
                                            default:
                                                sb.Append(dt.Rows[i][sData].ToString().Trim());
                                                break;
                                        }
                                    }
                                    else
                                    {
                                        sb.Append(GetDataRowReplace(gsw.ColumnList[n].ColumnShow, dt.Rows[i]));
                                    }

                                    sb.Append("</td>");

                            }
                            sb.Append("</tr>");
                        }

                    }

                    sb.Append("</table>");

                    response.HtmlString = sb.ToString();

                }
                else if (request.ProcessType == "client")
                {
                    response.DataItem = new List<List<string>>();

                    for (int i = 0, j = dt.Rows.Count; i < j; i++)
                    {
                        List<string> strList = new List<string>();
                        for (int n = 0, m = dt.Columns.Count; n < m; n++)
                        {
                            strList.Add(dt.Rows[i][n].ToString().Trim());

                        }
                        response.DataItem.Add(strList);
                    }
                }
                else if (request.ProcessType == "demo")
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append("<table id=\"GS_table_" + request.ClientId + "\" cellspacing=\"1\" cellpadding=\"0\">");

                    List<string> lTd = new List<string>();

                    sb.Append("<tr>");
                    for (int i = 0, j = request.ShowColumn.Count; i < j; i++)
                    {
                        if (GetSelectValue(request.ShowColumn[i].ShowDisplay) == "d")
                        {
                            sb.Append("<th>" + request.ShowColumn[i].HeaderText + "</th>");

                            lTd.Add("<td></td>");
                        }
                    }
                    sb.Append("</tr>");

                    string sTd = "<tr {0}>" + string.Join("", lTd.ToArray()) + "</tr>";

                    for (int i = 0; i < request.PageSize; i++)
                    {
                        sb.Append(string.Format( sTd," class=\"SWW_CSS_GS_TR_"+(i%2)+"\""));
                    }

                    sb.Append("");

                    response.HtmlString = sb.ToString();
                }
            }

            return response;
        }
Exemplo n.º 13
0
 /// <summary>
 /// 
 /// Description: 得到 数据集的总数
 /// Author:Liudpc
 /// Create Date: 2010-8-2 13:10:24
 /// </summary>
 /// <param name="gsw"></param>
 /// <returns></returns>
 public long GetDataCount(WebEntity.GridShowWWE gsw)
 {
     string sSql = "select count(1) from "+gsw.TableInfo.TableName+gsw.TableInfo.WhereString;
     return long.Parse(SrnprCommon.DataHelper.SqlHelperCDH.ExecuteScalar(GetConnString(gsw.TableInfo.DataBaseId), sSql).ToString());
 }
Exemplo n.º 14
0
        /// <summary>
        /// 
        /// Description: 根据实体取出数据
        /// Author:Liudpc
        /// Create Date: 2010-8-10 12:52:35
        /// </summary>
        /// <param name="gsw"></param>
        /// <param name="req"></param>
        /// <param name="sOrdeString"></param>
        /// <returns></returns>
        public DataTable GetDataByEntity(WebEntity.GridShowWWE gsw, GridShowRequestWWE req)
        {
            string sOrdeString = "";

            //开始智能分析排序字段
            if (req.ShowColumn.Count > 0)
            {

                var vSort = req.ShowColumn.FirstOrDefault(t => (t.OrderType == "a" || t.OrderType == "e"));
                if (vSort == null)
                {
                    vSort = gsw.ColumnList.FirstOrDefault(x => ReckeckOrderColumn(x.ColumnData) != "");
                }
                sOrdeString = ReckeckOrderColumn(gsw.ColumnList.SingleOrDefault(t => t.Guid == vSort.Guid).ColumnData) + (vSort.OrderType == "a" ? " asc " : " desc ");
            }

            string sWhere = gsw.TableInfo.WhereString;

            Dictionary<string, string> dQuery = new Dictionary<string, string>();

            if (req.QueryDict!=null&& req.QueryDict.Count > 0)
            {
                List<string> listStr = new List<string>();
                foreach (KeyValuePair<string, string> kvp in req.QueryDict)
                {

                    var o = gsw.ParamList.FirstOrDefault(t => t.ParamName == kvp.Key);
                    if (o != null && !string.IsNullOrEmpty(o.ParamName) && !string.IsNullOrEmpty(o.ColumnField))
                    {
                        string sParam = "";
                        switch (o.ParamQueryType)
                        {
                            case "a":
                                sParam += " and ";
                                break;
                            case "o":
                                sParam += " or ";
                                break;
                            case "d":
                            default:
                                sParam += " ";
                                break;
                        }

                        switch (o.ParamOperator)
                        {

                            case "e":
                                sParam += o.ColumnField+"=@"+kvp.Key;
                                dQuery.Add(kvp.Key, kvp.Value);

                                break;
                            case "b":
                                sParam += o.ColumnField + ">@" + kvp.Key;
                                dQuery.Add(kvp.Key, kvp.Value);
                                break;
                            case "s":
                                sParam += o.ColumnField + "<@" + kvp.Key;
                                dQuery.Add(kvp.Key, kvp.Value);
                                break;
                            case "l":
                                sParam += o.ColumnField + " like @" + kvp.Key;

                                dQuery.Add(kvp.Key, "%" + kvp.Value + "%");

                                break;
                            case "d":
                            default:
                                sParam += o.ColumnField;
                                dQuery.Add(kvp.Key, kvp.Value);
                                break;
                        }

                        listStr.Add(sParam);

                    }

                }

                if (listStr.Count > 0)
                {

                    sWhere += (string.IsNullOrEmpty(sWhere)?" 1=1" :"")+ string.Join(" ", listStr.ToArray());

                }

            }

            if (!string.IsNullOrEmpty(sWhere))
            {
                sWhere = " where " + sWhere;
            }

            string sGroupWhere = sWhere;

            if (!string.IsNullOrEmpty(gsw.TableInfo.GroupColumn) && !string.IsNullOrEmpty(req.GroupValue))
            {
                string sGroup = gsw.TableInfo.GroupColumn.Split(',')[0];

                dQuery[sGroup] = req.GroupValue;
                sWhere += (string.IsNullOrEmpty(sWhere) ? " where " : " and ") + sGroup + "=@" + sGroup;
            }

            //判断分组是否存在
            if (req.RowsCount == -1)
            {
                if (!string.IsNullOrEmpty(gsw.TableInfo.GroupColumn))
                {
                    string[] strSplit = gsw.TableInfo.GroupColumn.Split(',');

                    if (strSplit.Length > 0)
                    {
                        string sField, sGroup, sSum;
                        if (strSplit.Length == 1)
                        {
                            sGroup = strSplit[0];
                            sField = sGroup = strSplit[0];
                            sSum = "1";
                        }
                        else if (strSplit.Length == 2)
                        {
                            sGroup = strSplit[0];
                            sField = strSplit[1];
                            sSum = "1";
                        }
                        else
                        {
                            sGroup = strSplit[0];
                            sField = strSplit[1];
                            sSum = strSplit[2];
                        }

                        string sGroupSql = "select (" + sGroup + ") as k,sum(" + sSum + ") as v, (" + sField + ") as d from " + gsw.TableInfo.TableName + sGroupWhere + " group by " + sGroup;

                        DataTable dt = SrnprCommon.DataHelper.SqlHelperCDH.ExecuteDataTable(GetConnString(gsw.TableInfo.DataBaseId), sGroupSql);

                        List<WebEntity.ItemKvdWWE> kvdList = new List<ItemKvdWWE>();

                        for (int i = 0, j = dt.Rows.Count; i < j; i++)
                        {
                            kvdList.Add(new ItemKvdWWE() { K = dt.Rows[i][0].ToString().Trim(), V = dt.Rows[i][1].ToString().Trim(), D = dt.Rows[i][2].ToString().Trim() });
                        }
                        req.GroupKvd = kvdList;

                    }
                }

            }

            if (req.RowsCount < 0)
            {
                string sSqlCount = "select count(1) from " + gsw.TableInfo.TableName + sWhere;
                req.RowsCount = long.Parse(SrnprCommon.DataHelper.SqlHelperCDH.ExecuteScalar(GetConnString(gsw.TableInfo.DataBaseId), sSqlCount, dQuery).ToString());
            }

            string sSql = "select * from (select " + string.Join(",", gsw.ColumnList.Select(t => t.ColumnData).ToArray()) + " ,ROW_NUMBER() over(order by " + sOrdeString + ") as srspdatapageno from " + gsw.TableInfo.TableName + sWhere + " )srspdatapagetable where srspdatapagetable.srspdatapageno between " + ((req.PageIndex - 1) * req.PageSize + 1).ToString() + " and " + (req.PageIndex * req.PageSize).ToString();
            return SrnprCommon.DataHelper.SqlHelperCDH.ExecuteDataTable(GetConnString(gsw.TableInfo.DataBaseId), sSql, dQuery);
        }