Exemple #1
0
            /// <summary>
            /// 对象实体绑定数据
            /// </summary>
            public Lebi_Searchkey ReaderBind(IDataReader dataReader)
            {
                Lebi_Searchkey model = new Lebi_Searchkey();
                object         ojb;

                ojb = dataReader["id"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.id = (int)ojb;
                }
                model.Name = dataReader["Name"].ToString();
                ojb        = dataReader["Sort"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.Sort = (int)ojb;
                }
                ojb = dataReader["Type"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.Type = (int)ojb;
                }
                model.URL           = dataReader["URL"].ToString();
                model.Language_Code = dataReader["Language_Code"].ToString();
                ojb = dataReader["Language_id"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.Language_id = (int)ojb;
                }
                return(model);
            }
Exemple #2
0
            /// <summary>
            /// 更新一条数据
            /// </summary>
            public void Update(Lebi_Searchkey model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("update [Lebi_Searchkey] set ");
                strSql.Append("Name= @Name,");
                strSql.Append("Sort= @Sort,");
                strSql.Append("Type= @Type,");
                strSql.Append("URL= @URL,");
                strSql.Append("Language_Code= @Language_Code,");
                strSql.Append("Language_id= @Language_id");
                strSql.Append(" where id=@id");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@id",            SqlDbType.Int,         4),
                    new SqlParameter("@Name",          SqlDbType.NVarChar, 2000),
                    new SqlParameter("@Sort",          SqlDbType.Int,         4),
                    new SqlParameter("@Type",          SqlDbType.Int,         4),
                    new SqlParameter("@URL",           SqlDbType.NVarChar,  500),
                    new SqlParameter("@Language_Code", SqlDbType.NVarChar,   50),
                    new SqlParameter("@Language_id",   SqlDbType.Int, 4)
                };
                parameters[0].Value = model.id;
                parameters[1].Value = model.Name;
                parameters[2].Value = model.Sort;
                parameters[3].Value = model.Type;
                parameters[4].Value = model.URL;
                parameters[5].Value = model.Language_Code;
                parameters[6].Value = model.Language_id;

                SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters);
            }
Exemple #3
0
 /// <summary>
 /// 安全方式绑定对象表单
 /// </summary>
 public Lebi_Searchkey SafeBindForm(Lebi_Searchkey model)
 {
     if (HttpContext.Current.Request["Name"] != null)
     {
         model.Name = Shop.Tools.RequestTool.RequestSafeString("Name");
     }
     if (HttpContext.Current.Request["Sort"] != null)
     {
         model.Sort = Shop.Tools.RequestTool.RequestInt("Sort", 0);
     }
     if (HttpContext.Current.Request["Type"] != null)
     {
         model.Type = Shop.Tools.RequestTool.RequestInt("Type", 0);
     }
     if (HttpContext.Current.Request["URL"] != null)
     {
         model.URL = Shop.Tools.RequestTool.RequestSafeString("URL");
     }
     if (HttpContext.Current.Request["Language_Code"] != null)
     {
         model.Language_Code = Shop.Tools.RequestTool.RequestSafeString("Language_Code");
     }
     if (HttpContext.Current.Request["Language_id"] != null)
     {
         model.Language_id = Shop.Tools.RequestTool.RequestInt("Language_id", 0);
     }
     return(model);
 }
Exemple #4
0
            /// <summary>
            /// 增加一条数据
            /// </summary>
            public int Add(Lebi_Searchkey model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("insert into [Lebi_Searchkey](");
                strSql.Append("Name,Sort,Type,URL,Language_Code,Language_id)");
                strSql.Append(" values (");
                strSql.Append("@Name,@Sort,@Type,@URL,@Language_Code,@Language_id)");
                strSql.Append(";select @@IDENTITY");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@Name",          model.Name),
                    new SqlParameter("@Sort",          model.Sort),
                    new SqlParameter("@Type",          model.Type),
                    new SqlParameter("@URL",           model.URL),
                    new SqlParameter("@Language_Code", model.Language_Code),
                    new SqlParameter("@Language_id",   model.Language_id)
                };

                object obj = SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters);

                if (obj == null)
                {
                    return(1);
                }
                else
                {
                    return(Convert.ToInt32(obj));
                }
            }
Exemple #5
0
            /// <summary>
            /// 得到一个对象实体 by id
            /// </summary>
            public Lebi_Searchkey GetModel(int id)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("select  top 1  * from [Lebi_Searchkey] ");
                strSql.Append(" where id=@id");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@id", SqlDbType.Int, 4)
                };
                parameters[0].Value = id;

                Lebi_Searchkey model = new Lebi_Searchkey();
                DataSet        ds    = SqlUtils.SqlUtilsInstance.TextExecuteDataset(strSql.ToString(), parameters);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                    {
                        model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                    }
                    model.Name = ds.Tables[0].Rows[0]["Name"].ToString();
                    if (ds.Tables[0].Rows[0]["Sort"].ToString() != "")
                    {
                        model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["Type"].ToString() != "")
                    {
                        model.Type = int.Parse(ds.Tables[0].Rows[0]["Type"].ToString());
                    }
                    model.URL           = ds.Tables[0].Rows[0]["URL"].ToString();
                    model.Language_Code = ds.Tables[0].Rows[0]["Language_Code"].ToString();
                    if (ds.Tables[0].Rows[0]["Language_id"].ToString() != "")
                    {
                        model.Language_id = int.Parse(ds.Tables[0].Rows[0]["Language_id"].ToString());
                    }
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
Exemple #6
0
            /// <summary>
            /// 得到一个对象实体 by where条件
            /// </summary>
            public Lebi_Searchkey GetModel(string strWhere)
            {
                if (strWhere.IndexOf("lbsql{") > 0)
                {
                    SQLPara para = new SQLPara(strWhere, "", "");
                    return(GetModel(para));
                }
                StringBuilder strSql = new StringBuilder();

                strSql.Append("select  top 1  * from [Lebi_Searchkey] ");
                strSql.Append(" where " + strWhere + "");
                Lebi_Searchkey model = new Lebi_Searchkey();
                DataSet        ds    = SqlUtils.SqlUtilsInstance.TextExecuteDataset(strSql.ToString());

                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                    {
                        model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                    }
                    model.Name = ds.Tables[0].Rows[0]["Name"].ToString();
                    if (ds.Tables[0].Rows[0]["Sort"].ToString() != "")
                    {
                        model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["Type"].ToString() != "")
                    {
                        model.Type = int.Parse(ds.Tables[0].Rows[0]["Type"].ToString());
                    }
                    model.URL           = ds.Tables[0].Rows[0]["URL"].ToString();
                    model.Language_Code = ds.Tables[0].Rows[0]["Language_Code"].ToString();
                    if (ds.Tables[0].Rows[0]["Language_id"].ToString() != "")
                    {
                        model.Language_id = int.Parse(ds.Tables[0].Rows[0]["Language_id"].ToString());
                    }
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
Exemple #7
0
            /// <summary>
            /// 增加一条数据
            /// </summary>
            public int Add(Lebi_Searchkey model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("insert into [Lebi_Searchkey](");
                strSql.Append("[Name],[Sort],[Type],[URL],[Language_Code],[Language_id])");
                strSql.Append(" values (");
                strSql.Append("@Name,@Sort,@Type,@URL,@Language_Code,@Language_id)");
                OleDbParameter[] parameters =
                {
                    new OleDbParameter("@Name",          model.Name),
                    new OleDbParameter("@Sort",          model.Sort),
                    new OleDbParameter("@Type",          model.Type),
                    new OleDbParameter("@URL",           model.URL),
                    new OleDbParameter("@Language_Code", model.Language_Code),
                    new OleDbParameter("@Language_id",   model.Language_id)
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
                return(1);
            }
Exemple #8
0
            /// <summary>
            /// 更新一条数据
            /// </summary>
            public void Update(Lebi_Searchkey model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("update [Lebi_Searchkey] set ");
                strSql.Append("[Name]=@Name,");
                strSql.Append("[Sort]=@Sort,");
                strSql.Append("[Type]=@Type,");
                strSql.Append("[URL]=@URL,");
                strSql.Append("[Language_Code]=@Language_Code,");
                strSql.Append("[Language_id]=@Language_id");
                strSql.Append(" where id=" + model.id);
                OleDbParameter[] parameters =
                {
                    new OleDbParameter("@Name",          model.Name),
                    new OleDbParameter("@Sort",          model.Sort),
                    new OleDbParameter("@Type",          model.Type),
                    new OleDbParameter("@URL",           model.URL),
                    new OleDbParameter("@Language_Code", model.Language_Code),
                    new OleDbParameter("@Language_id",   model.Language_id)
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
            }
Exemple #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     id = RequestTool.RequestInt("id", 0);
     if (id == 0)
     {
         if (!EX_Admin.Power("searchkey_add", "添加关键词"))
         {
             WindowNoPower();
         }
     }
     else
     {
         if (!EX_Admin.Power("searchkey_edit", "编辑关键词"))
         {
             WindowNoPower();
         }
     }
     model = B_Lebi_Searchkey.GetModel(id);
     if (model == null)
     {
         model      = new Lebi_Searchkey();
         model.Type = 1;
     }
 }
Exemple #10
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static void Update(Lebi_Searchkey model)
 {
     D_Lebi_Searchkey.Instance.Update(model);
 }
Exemple #11
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static int Add(Lebi_Searchkey model)
 {
     return(D_Lebi_Searchkey.Instance.Add(model));
 }
Exemple #12
0
 /// <summary>
 /// 安全方式绑定表单数据
 /// </summary>
 public static Lebi_Searchkey SafeBindForm(Lebi_Searchkey model)
 {
     return(D_Lebi_Searchkey.Instance.SafeBindForm(model));
 }