예제 #1
0
        private string ContentSourceLabelProc(string ilabel, int Cpage, int InfoID, string Result)
        {
            M_Label label = new M_Label();
            B_Label bll = new B_Label();
            Hashtable hb = GetParam(ilabel);
            string temp = Result;
            if (!hb.Contains("id"))
            {
                temp.Replace(ilabel, "[err:标签不正确]");
                return temp;
            }
            label = bll.GetLabel(hb["id"].ToString());
            string strSql = "Select ";
            string sqlCount = "";
            string sqlField = "";
            string sqlTable = "";
            string sqlWhere = "";
            string sqlOrder = "";

            if (string.IsNullOrEmpty(label.LabelField))
            {
                temp.Replace(ilabel, "[err:标签没有定义查询的字段数据]");
                return temp;
            }
            else
            {
                sqlField = label.LabelField;
            }
            if (string.IsNullOrEmpty(label.LabelTable))
            {
                temp.Replace(ilabel, "[err:标签没有定义查询的数据表]");
                return temp;
            }
            else
            {
                sqlTable = label.LabelTable;
            }
            if (!string.IsNullOrEmpty(label.LabelCount))
                sqlCount = label.LabelCount;
            if (!string.IsNullOrEmpty(label.LabelWhere))
                sqlWhere = label.LabelWhere;
            if (!string.IsNullOrEmpty(label.LabelOrder))
                sqlOrder = label.LabelOrder;
            //替换参数
            if (!string.IsNullOrEmpty(label.Param))
            {
                string[] pa = label.Param.Split(new char[] { '|' });
                string paname = "";
                for (int i = 0; i < pa.Length; i++)
                {
                    paname = pa[i].Split(new char[] { ',' })[0];
                    if (DataConverter.CLng(pa[i].Split(new char[] { ',' })[2]) == 2)
                    {
                        sqlWhere = sqlWhere.Replace("@" + paname, InfoID.ToString());
                    }
                    else
                    {
                        sqlField = sqlField.Replace("@" + paname, hb["" + paname + ""].ToString());
                        sqlWhere = sqlWhere.Replace("@" + paname, hb["" + paname + ""].ToString());
                        sqlCount = sqlCount.Replace("@" + paname, hb["" + paname + ""].ToString());
                    }
                }
            }
            //组合查询语句
            if (DataConverter.CLng(sqlCount) > 0)
                strSql = strSql + "top " + sqlCount + " ";
            strSql = strSql + sqlField + " ";
            strSql = strSql + "From " + sqlTable + " ";
            if (!string.IsNullOrEmpty(sqlWhere))
                strSql = strSql + "Where " + sqlWhere + " ";
            if (!string.IsNullOrEmpty(sqlOrder))
                strSql = strSql + "Order by " + sqlOrder;
            DataTable dt = SqlHelper.ExecuteTable(CommandType.Text, strSql, null);
            temp = temp.Replace(ilabel, "");
            return GetHtmlSource(temp, hb["id"].ToString(), dt);
        }
예제 #2
0
파일: B_CreateHtml.cs 프로젝트: zwt-zf/cms
        private string ContentSourceLabelProc(string ilabel, int Cpage, int InfoID, string Result)
        {
            M_Label   label = new M_Label();
            B_Label   bll   = new B_Label();
            Hashtable hb    = GetParam(ilabel);
            string    temp  = Result;

            if (!hb.Contains("id"))
            {
                temp.Replace(ilabel, "[err:标签不正确]");
                return(temp);
            }
            label = bll.GetLabel(hb["id"].ToString());
            string strSql   = "Select ";
            string sqlCount = "";
            string sqlField = "";
            string sqlTable = "";
            string sqlWhere = "";
            string sqlOrder = "";

            if (string.IsNullOrEmpty(label.LabelField))
            {
                temp.Replace(ilabel, "[err:标签没有定义查询的字段数据]");
                return(temp);
            }
            else
            {
                sqlField = label.LabelField;
            }
            if (string.IsNullOrEmpty(label.LabelTable))
            {
                temp.Replace(ilabel, "[err:标签没有定义查询的数据表]");
                return(temp);
            }
            else
            {
                sqlTable = label.LabelTable;
            }
            if (!string.IsNullOrEmpty(label.LabelCount))
            {
                sqlCount = label.LabelCount;
            }
            if (!string.IsNullOrEmpty(label.LabelWhere))
            {
                sqlWhere = label.LabelWhere;
            }
            if (!string.IsNullOrEmpty(label.LabelOrder))
            {
                sqlOrder = label.LabelOrder;
            }
            //替换参数
            if (!string.IsNullOrEmpty(label.Param))
            {
                string[] pa     = label.Param.Split(new char[] { '|' });
                string   paname = "";
                for (int i = 0; i < pa.Length; i++)
                {
                    paname = pa[i].Split(new char[] { ',' })[0];
                    if (DataConverter.CLng(pa[i].Split(new char[] { ',' })[2]) == 2)
                    {
                        sqlWhere = sqlWhere.Replace("@" + paname, InfoID.ToString());
                    }
                    else
                    {
                        sqlField = sqlField.Replace("@" + paname, hb["" + paname + ""].ToString());
                        sqlWhere = sqlWhere.Replace("@" + paname, hb["" + paname + ""].ToString());
                        sqlCount = sqlCount.Replace("@" + paname, hb["" + paname + ""].ToString());
                    }
                }
            }
            //组合查询语句
            if (DataConverter.CLng(sqlCount) > 0)
            {
                strSql = strSql + "top " + sqlCount + " ";
            }
            strSql = strSql + sqlField + " ";
            strSql = strSql + "From " + sqlTable + " ";
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                strSql = strSql + "Where " + sqlWhere + " ";
            }
            if (!string.IsNullOrEmpty(sqlOrder))
            {
                strSql = strSql + "Order by " + sqlOrder;
            }
            DataTable dt = SqlHelper.ExecuteTable(CommandType.Text, strSql, null);

            temp = temp.Replace(ilabel, "");
            return(GetHtmlSource(temp, hb["id"].ToString(), dt));
        }
예제 #3
0
        /// <summary>
        /// 处理标签取得换算后的标签Html的代码
        /// </summary>
        /// <param name="ilabel"></param>
        /// <returns></returns>
        private string ContentLabelProc(string ilabel, int Cpage, int InfoID)
        {
            M_Label label = new M_Label();
            B_Label bll = new B_Label();
            Hashtable hb = GetParam(ilabel);
            if (!hb.Contains("id"))
            {
                return "[err:标签不正确]";
            }
            label = bll.GetLabel(hb["id"].ToString());
            if (label.LableType == 1)
            {
                return label.Content;
            }
            else
            {
                string labelcontent = label.Content;
                string strSql = "Select ";
                string sqlCount = "";
                string sqlField = "";
                string sqlTable = "";
                string sqlWhere = "";
                string sqlOrder = "";
                string sqlIdentity = "";
                sqlCount = label.LabelCount;

                if (string.IsNullOrEmpty(label.LabelField))
                {
                    return "[err:标签没有定义查询的字段数据]";
                }
                else
                {
                    sqlField = label.LabelField;
                }
                if (string.IsNullOrEmpty(label.LabelTable))
                {
                    return "[err:标签没有定义查询的数据表]";
                }
                else
                {
                    sqlTable = label.LabelTable;
                }
                if (!string.IsNullOrEmpty(label.LabelWhere))
                    sqlWhere = label.LabelWhere;
                if (!string.IsNullOrEmpty(label.LabelOrder))
                    sqlOrder = label.LabelOrder;

                if (!string.IsNullOrEmpty(label.Param))
                {
                    string[] pa = label.Param.Split(new char[] { '|' });
                    string paname = "";
                    for (int i = 0; i < pa.Length; i++)
                    {
                        paname = pa[i].Split(new char[] { ',' })[0];
                        if (DataConverter.CLng(pa[i].Split(new char[] { ',' })[2]) == 2)
                        {
                            sqlWhere = sqlWhere.Replace("@" + paname, InfoID.ToString());
                        }
                        else
                        {
                            labelcontent = labelcontent.Replace("@" + paname, hb["" + paname + ""].ToString());
                            sqlField = sqlField.Replace("@" + paname, hb["" + paname + ""].ToString());
                            sqlWhere = sqlWhere.Replace("@" + paname, hb["" + paname + ""].ToString());
                            sqlCount = sqlCount.Replace("@" + paname, hb["" + paname + ""].ToString());
                        }
                    }
                }
                if (label.LableType == 2)
                {
                    if (DataConverter.CLng(sqlCount) > 0)
                        strSql = strSql + "top " + sqlCount + " ";
                    strSql = strSql + sqlField + " ";
                    strSql = strSql + "From " + sqlTable + " ";
                    if (!string.IsNullOrEmpty(sqlWhere))
                        strSql = strSql + "Where " + sqlWhere + " ";
                    if (!string.IsNullOrEmpty(sqlOrder))
                        strSql = strSql + "Order by " + sqlOrder;
                    DataTable dt = SqlHelper.ExecuteTable(CommandType.Text, strSql, null);
                    return GetHtmlContent(labelcontent, dt);
                }
                else
                {
                    strSql = "PR_GetRecordFromPage";
                    SqlParameter[] cmdParam = new SqlParameter[] {
                        new SqlParameter("@TableName",SqlDbType.VarChar),       //表名,可以是多个表
                        new SqlParameter("@Identity",SqlDbType.VarChar),
                        new SqlParameter("@Fields",SqlDbType.VarChar),          //要取出的字段,可以是多个表的字段,可以为空,为空表示select *
                        new SqlParameter("@sqlWhere",SqlDbType.VarChar),        //条件,可以为空,不用填 where
                        new SqlParameter("@OrderField",SqlDbType.VarChar),      //排序字段,可以为空,为空默认按主键升序排列,不用填 order by
                        new SqlParameter("@pageSize",SqlDbType.Int),            //每页记录数
                        new SqlParameter("@pageIndex",SqlDbType.Int)            //当前页,1表示第1页
                    };
                    cmdParam[0].Value = sqlTable;
                    cmdParam[1].Value = sqlIdentity;
                    cmdParam[2].Value = sqlField;
                    cmdParam[3].Value = sqlWhere;
                    cmdParam[4].Value = sqlOrder;
                    cmdParam[5].Value = DataConverter.CLng(sqlCount);
                    cmdParam[6].Value = Cpage - 1;

                    DataSet ds = SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, strSql, cmdParam);
                    DataTable dt = ds.Tables[0];
                    DataTable dt1 = ds.Tables[1];

                    int Count = DataConverter.CLng(dt.Rows[0][0]);
                    labelcontent = labelcontent.Replace("{ZL.Page/}", function.ShowlistPage(Count, DataConverter.CLng(sqlCount), Cpage, true, InfoID));
                    return GetHtmlContent(labelcontent, dt1);
                }
            }
        }
예제 #4
0
파일: B_CreateHtml.cs 프로젝트: zwt-zf/cms
        /// <summary>
        /// 处理标签取得换算后的标签Html的代码
        /// </summary>
        /// <param name="ilabel"></param>
        /// <returns></returns>
        private string ContentLabelProc(string ilabel, int Cpage, int InfoID)
        {
            M_Label   label = new M_Label();
            B_Label   bll   = new B_Label();
            Hashtable hb    = GetParam(ilabel);

            if (!hb.Contains("id"))
            {
                return("[err:标签不正确]");
            }
            label = bll.GetLabel(hb["id"].ToString());
            if (label.LableType == 1)
            {
                return(label.Content);
            }
            else
            {
                string labelcontent = label.Content;
                string strSql       = "Select ";
                string sqlCount     = "";
                string sqlField     = "";
                string sqlTable     = "";
                string sqlWhere     = "";
                string sqlOrder     = "";
                string sqlIdentity  = "";
                sqlCount = label.LabelCount;


                if (string.IsNullOrEmpty(label.LabelField))
                {
                    return("[err:标签没有定义查询的字段数据]");
                }
                else
                {
                    sqlField = label.LabelField;
                }
                if (string.IsNullOrEmpty(label.LabelTable))
                {
                    return("[err:标签没有定义查询的数据表]");
                }
                else
                {
                    sqlTable = label.LabelTable;
                }
                if (!string.IsNullOrEmpty(label.LabelWhere))
                {
                    sqlWhere = label.LabelWhere;
                }
                if (!string.IsNullOrEmpty(label.LabelOrder))
                {
                    sqlOrder = label.LabelOrder;
                }

                if (!string.IsNullOrEmpty(label.Param))
                {
                    string[] pa     = label.Param.Split(new char[] { '|' });
                    string   paname = "";
                    for (int i = 0; i < pa.Length; i++)
                    {
                        paname = pa[i].Split(new char[] { ',' })[0];
                        if (DataConverter.CLng(pa[i].Split(new char[] { ',' })[2]) == 2)
                        {
                            sqlWhere = sqlWhere.Replace("@" + paname, InfoID.ToString());
                        }
                        else
                        {
                            labelcontent = labelcontent.Replace("@" + paname, hb["" + paname + ""].ToString());
                            sqlField     = sqlField.Replace("@" + paname, hb["" + paname + ""].ToString());
                            sqlWhere     = sqlWhere.Replace("@" + paname, hb["" + paname + ""].ToString());
                            sqlCount     = sqlCount.Replace("@" + paname, hb["" + paname + ""].ToString());
                        }
                    }
                }
                if (label.LableType == 2)
                {
                    if (DataConverter.CLng(sqlCount) > 0)
                    {
                        strSql = strSql + "top " + sqlCount + " ";
                    }
                    strSql = strSql + sqlField + " ";
                    strSql = strSql + "From " + sqlTable + " ";
                    if (!string.IsNullOrEmpty(sqlWhere))
                    {
                        strSql = strSql + "Where " + sqlWhere + " ";
                    }
                    if (!string.IsNullOrEmpty(sqlOrder))
                    {
                        strSql = strSql + "Order by " + sqlOrder;
                    }
                    DataTable dt = SqlHelper.ExecuteTable(CommandType.Text, strSql, null);
                    return(GetHtmlContent(labelcontent, dt));
                }
                else
                {
                    strSql = "PR_GetRecordFromPage";
                    SqlParameter[] cmdParam = new SqlParameter[] {
                        new SqlParameter("@TableName", SqlDbType.VarChar),       //表名,可以是多个表
                        new SqlParameter("@Identity", SqlDbType.VarChar),
                        new SqlParameter("@Fields", SqlDbType.VarChar),          //要取出的字段,可以是多个表的字段,可以为空,为空表示select *
                        new SqlParameter("@sqlWhere", SqlDbType.VarChar),        //条件,可以为空,不用填 where
                        new SqlParameter("@OrderField", SqlDbType.VarChar),      //排序字段,可以为空,为空默认按主键升序排列,不用填 order by
                        new SqlParameter("@pageSize", SqlDbType.Int),            //每页记录数
                        new SqlParameter("@pageIndex", SqlDbType.Int)            //当前页,1表示第1页
                    };
                    cmdParam[0].Value = sqlTable;
                    cmdParam[1].Value = sqlIdentity;
                    cmdParam[2].Value = sqlField;
                    cmdParam[3].Value = sqlWhere;
                    cmdParam[4].Value = sqlOrder;
                    cmdParam[5].Value = DataConverter.CLng(sqlCount);
                    cmdParam[6].Value = Cpage - 1;

                    DataSet   ds  = SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, strSql, cmdParam);
                    DataTable dt  = ds.Tables[0];
                    DataTable dt1 = ds.Tables[1];

                    int Count = DataConverter.CLng(dt.Rows[0][0]);
                    labelcontent = labelcontent.Replace("{ZL.Page/}", function.ShowlistPage(Count, DataConverter.CLng(sqlCount), Cpage, true, InfoID));
                    return(GetHtmlContent(labelcontent, dt1));
                }
            }
        }