コード例 #1
0
ファイル: SuperLabel.cs プロジェクト: suizhikuo/KYCMS
 public void Add(M_SuperLabel model)
 {
     SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@Name", SqlDbType.NVarChar), new SqlParameter("@LbCategoryName", SqlDbType.NVarChar), new SqlParameter("@LbCategoryId", SqlDbType.Int, 4), new SqlParameter("@DataBaseType", SqlDbType.Int, 4), new SqlParameter("@SuperDes", SqlDbType.NVarChar), new SqlParameter("@IsUnlockPage", SqlDbType.Bit, 1), new SqlParameter("@HostTable", SqlDbType.NVarChar), new SqlParameter("@GuestTable", SqlDbType.NVarChar), new SqlParameter("@SqlStr", SqlDbType.NVarChar), new SqlParameter("@Content", SqlDbType.NText), new SqlParameter("@AddTime", SqlDbType.DateTime), new SqlParameter("@PageSize", SqlDbType.Int), new SqlParameter("@IsHtml", SqlDbType.Bit, 1), new SqlParameter("@NumColumns", SqlDbType.Int), new SqlParameter("@DataBaseConn", SqlDbType.NVarChar) };
     commandParameters[0].Value = model.Name;
     commandParameters[1].Value = model.LbCategoryName;
     commandParameters[2].Value = model.LbCategoryId;
     commandParameters[3].Value = model.DataBaseType;
     commandParameters[4].Value = model.SuperDes;
     commandParameters[5].Value = model.IsUnlockPage;
     commandParameters[6].Value = model.HostTable;
     commandParameters[7].Value = model.GuestTable;
     commandParameters[8].Value = model.SqlStr;
     commandParameters[9].Value = model.Content;
     commandParameters[10].Value = model.AddTime;
     commandParameters[11].Value = model.PageSize;
     commandParameters[12].Value = model.IsHtml;
     commandParameters[13].Value = model.NumColumns;
     commandParameters[14].Value = model.DataBaseConn;
     SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_SuperLabel_Add", commandParameters);
 }
コード例 #2
0
ファイル: B_Create.cs プロジェクト: suizhikuo/KYCMS
 public string GetSuperLabel(string Name, int UserId)
 {
     object obj2;
     string str = "";
     B_SuperLabel label = new B_SuperLabel();
     M_SuperLabel model = new M_SuperLabel();
     int superId = label.GetSuperId(Name);
     model = label.GetModel(superId);
     if (superId == 0)
     {
         return "该超级标签名称出错!";
     }
     if ((model.DataBaseType == 1) || (model.DataBaseType == 3))
     {
         if (model.IsHtml)
         {
             string sqlStr = model.SqlStr;
             MatchCollection matchs = Regex.Matches(sqlStr, "{#(.*?)}", RegexOptions.IgnoreCase);
             if (matchs.Count > 0)
             {
                 DataRow userAllInfo = new B_User().GetUserAllInfo(UserId);
                 foreach (Match match in matchs)
                 {
                     sqlStr = sqlStr.Replace("{#" + match.Groups[1].Value + "}", userAllInfo["" + match.Groups[1].Value + ""].ToString());
                 }
             }
             DataTable table = new DataTable();
             if (model.DataBaseType == 3)
             {
                 table = label.DataBaseTypeSql(model.DataBaseConn, model.DataBaseType.ToString(), sqlStr);
             }
             else
             {
                 table = label.CheckSql(sqlStr);
             }
             this.SqlContent = model.Content;
             this.MySqlContent = new string[3];
             this.GetStyle(this.MySqlContent);
             this.ColumnsContent = this.MySqlContent[1];
             this.MyColumnsContent = new string[3];
             this.GetStyleColumns(this.MyColumnsContent);
             int numColumns = model.NumColumns;
             int num4 = table.Rows.Count / numColumns;
             str = str + this.MySqlContent[0];
             for (int i = 0; i < table.Rows.Count; i++)
             {
                 if ((this.MySqlContent[1].Trim().ToLower().IndexOf("<ky_loop_columns>") > 0) && (this.MySqlContent[1].Trim().ToLower().IndexOf("</ky_loop_columns>") > 0))
                 {
                     str = str + this.MyColumnsContent[0];
                     int num6 = 0;
                     while (num6 < model.NumColumns)
                     {
                         if (i == table.Rows.Count)
                         {
                             str = str + this.MyColumnsContent[0] + this.MyColumnsContent[2];
                         }
                         else
                         {
                             str = str + "" + this.StrValue(table.Rows[i], model.HostTable, this.MyColumnsContent[1]) + "";
                         }
                         num6++;
                         i++;
                     }
                     str = str + this.MyColumnsContent[2];
                 }
                 else
                 {
                     str = str + "" + this.StrValue(table.Rows[i], model.HostTable, this.MySqlContent[1]) + "";
                 }
             }
             str = str + this.MySqlContent[2];
         }
         else
         {
             obj2 = str + "<!---" + Name.Replace("{Ky_S_", "").Replace("}", "") + "超级标签开始-->";
             obj2 = string.Concat(new object[] { obj2, "<div id='SuperLabel_Div_", superId, "'></div>" });
             str = string.Concat(new object[] { obj2, "<script language=\"javascript\">var data = XmlHttpPostMethodText(\"", Param.ApplicationRootPath, "/common/SuperLabelList.aspx?SuperId=", superId, "&UserId=", UserId, "\",\"\");document.getElementById('SuperLabel_Div_", superId, "').innerHTML=data;</script>" }) + "<!---" + Name.Replace("{Ky_S_", "").Replace("}", "") + "超级标签结束-->";
         }
     }
     if (model.DataBaseType != 2)
     {
         return str;
     }
     if (model.IsHtml)
     {
         try
         {
             WebClient client = new WebClient();
             client.Encoding = Encoding.GetEncoding("utf-8");
             byte[] bytes = client.DownloadData("" + model.SqlStr + "");
             return Encoding.GetEncoding("utf-8").GetString(bytes);
         }
         catch
         {
             return "读取外部数据错误";
         }
     }
     obj2 = str + "<!---" + Name.Replace("{Ky_S_", "").Replace("}", "") + "超级标签开始-->";
     obj2 = string.Concat(new object[] { obj2, "<div id='SuperLabel_Div_", superId, "'></div>" });
     return (string.Concat(new object[] { obj2, "<script language=\"javascript\">var data = XmlHttpPostMethodText(\"", model.SqlStr, "\",\"\");document.getElementById('SuperLabel_Div_", superId, "').innerHTML=data;</script>" }) + "<!---" + Name.Replace("{Ky_S_", "").Replace("}", "") + "超级标签结束-->");
 }
コード例 #3
0
ファイル: B_SuperLabel.cs プロジェクト: suizhikuo/KYCMS
 public void Update(M_SuperLabel model)
 {
     this.dal.Update(model);
 }
コード例 #4
0
ファイル: B_SuperLabel.cs プロジェクト: suizhikuo/KYCMS
 public void Add(M_SuperLabel model)
 {
     this.dal.Add(model);
 }
コード例 #5
0
ファイル: SuperLabel.aspx.cs プロジェクト: suizhikuo/KYCMS
    //显示值
    private void GetShow()
    {
        MSuperLabel = BSuperLabel.GetModel(SuperId);

        txtName.Text = MSuperLabel.Name.Replace("{Ky_S_", "").Replace("}", "");
        DataBaseType.SelectedValue = MSuperLabel.DataBaseType.ToString();
        txtSuperDes.Text = MSuperLabel.SuperDes;

        if (MSuperLabel.DataBaseType == 2)
        {
            IsHtml2.SelectedValue = MSuperLabel.IsHtml.ToString();
            TxtStrSql1.Text = MSuperLabel.SqlStr;
        }
        else
        {
            //txtLbCategoryName.Text = MSuperLabel.LbCategoryName;
            //txtLbCategoryId.Text = MSuperLabel.LbCategoryId.ToString();

            txtLbCategoryName.Text = "";
            txtLbCategoryId.Text = "0";

            TxtHostTable.Text = MSuperLabel.HostTable;
            TxtGuestTable.Text = MSuperLabel.GuestTable;
            TxtNumColumns.Text = MSuperLabel.NumColumns.ToString();
            SuperLabelSqlText.Text = MSuperLabel.SqlStr;
            IsUnlockPage.SelectedValue = MSuperLabel.IsUnlockPage.ToString();
            TxtPageSize.Text = MSuperLabel.PageSize.ToString();
            test.Text = MSuperLabel.Content;
            PageSize.Text = MSuperLabel.PageSize.ToString();
            NumColumns.SelectedValue = MSuperLabel.NumColumns.ToString();
            IsHtml.SelectedValue = MSuperLabel.IsHtml.ToString();
            TxtDataBaseConn.Text = MSuperLabel.DataBaseConn;

            if (MSuperLabel.DataBaseType == 3)
            {
                SqlIp.Text = MSuperLabel.DataBaseConn.Split(';')[3].Split('=')[1];
                SqlName.Text = MSuperLabel.DataBaseConn.Split(';')[2].Split('=')[1];
                SqlUserName.Text = MSuperLabel.DataBaseConn.Split(';')[0].Split('=')[1];
                SqlPassWord.Text = MSuperLabel.DataBaseConn.Split(';')[1].Split('=')[1];
            }
        }
    }
コード例 #6
0
ファイル: SuperLabel.cs プロジェクト: suizhikuo/KYCMS
 public M_SuperLabel GetModel(int SuperId)
 {
     SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@SuperId", SqlDbType.Int, 4) };
     commandParameters[0].Value = SuperId;
     M_SuperLabel label = new M_SuperLabel();
     DataSet set = SqlHelper.ExecuteDataSet(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_SuperLabel_GetModel", commandParameters);
     label.SuperId = SuperId;
     if (set.Tables[0].Rows.Count > 0)
     {
         label.Name = set.Tables[0].Rows[0]["Name"].ToString();
         label.LbCategoryName = set.Tables[0].Rows[0]["LbCategoryName"].ToString();
         if (set.Tables[0].Rows[0]["LbCategoryId"].ToString() != "")
         {
             label.LbCategoryId = int.Parse(set.Tables[0].Rows[0]["LbCategoryId"].ToString());
         }
         if (set.Tables[0].Rows[0]["DataBaseType"].ToString() != "")
         {
             label.DataBaseType = int.Parse(set.Tables[0].Rows[0]["DataBaseType"].ToString());
         }
         label.SuperDes = set.Tables[0].Rows[0]["SuperDes"].ToString();
         if (set.Tables[0].Rows[0]["IsUnlockPage"].ToString() != "")
         {
             if ((set.Tables[0].Rows[0]["IsUnlockPage"].ToString() == "1") || (set.Tables[0].Rows[0]["IsUnlockPage"].ToString().ToLower() == "true"))
             {
                 label.IsUnlockPage = true;
             }
             else
             {
                 label.IsUnlockPage = false;
             }
         }
         label.HostTable = set.Tables[0].Rows[0]["HostTable"].ToString();
         label.GuestTable = set.Tables[0].Rows[0]["GuestTable"].ToString();
         label.SqlStr = set.Tables[0].Rows[0]["SqlStr"].ToString();
         label.Content = set.Tables[0].Rows[0]["Content"].ToString();
         if (set.Tables[0].Rows[0]["AddTime"].ToString() != "")
         {
             label.AddTime = DateTime.Parse(set.Tables[0].Rows[0]["AddTime"].ToString());
         }
         if (set.Tables[0].Rows[0]["PageSize"].ToString() != "")
         {
             label.PageSize = int.Parse(set.Tables[0].Rows[0]["PageSize"].ToString());
         }
         if (set.Tables[0].Rows[0]["NumColumns"].ToString() != "")
         {
             label.NumColumns = int.Parse(set.Tables[0].Rows[0]["NumColumns"].ToString());
         }
         if (set.Tables[0].Rows[0]["IsHtml"].ToString() != "")
         {
             if ((set.Tables[0].Rows[0]["IsHtml"].ToString() == "1") || (set.Tables[0].Rows[0]["IsHtml"].ToString().ToLower() == "true"))
             {
                 label.IsHtml = true;
             }
             else
             {
                 label.IsHtml = false;
             }
         }
         label.DataBaseConn = set.Tables[0].Rows[0]["DataBaseConn"].ToString();
         return label;
     }
     return null;
 }
コード例 #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Cache.SetNoStore();
        if (!string.IsNullOrEmpty(Request.QueryString["SuperId"]))
        {
            try
            {
                SuperId = int.Parse(Request.QueryString["SuperId"]);
            }
            catch { }
        }

        MSuperLabel = BSuperLabel.GetModel(SuperId);
        SqlContent = MSuperLabel.Content;
        MySqlContent = new string[3];
        GetStyle(MySqlContent);

        //循环列
        ColumnsContent = MySqlContent[1];
        MyColumnsContent = new string[3];
        GetStyleColumns(MyColumnsContent);

        if (!Page.IsPostBack)
        {
            DataBindList();
        }
    }