Ejemplo n.º 1
0
            /// <summary>
            /// 更新一条数据
            /// </summary>
            public void Update(Lebi_FriendLink model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("update [Lebi_FriendLink] set ");
                strSql.Append("[Name]=@Name,");
                strSql.Append("[Url]=@Url,");
                strSql.Append("[Sort]=@Sort,");
                strSql.Append("[Logo]=@Logo,");
                strSql.Append("[IsPic]=@IsPic,");
                strSql.Append("[IsShow]=@IsShow,");
                strSql.Append("[Language]=@Language,");
                strSql.Append("[Language_ids]=@Language_ids");
                strSql.Append(" where id=" + model.id);
                OleDbParameter[] parameters =
                {
                    new OleDbParameter("@Name",         model.Name),
                    new OleDbParameter("@Url",          model.Url),
                    new OleDbParameter("@Sort",         model.Sort),
                    new OleDbParameter("@Logo",         model.Logo),
                    new OleDbParameter("@IsPic",        model.IsPic),
                    new OleDbParameter("@IsShow",       model.IsShow),
                    new OleDbParameter("@Language",     model.Language),
                    new OleDbParameter("@Language_ids", model.Language_ids)
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
            }
Ejemplo n.º 2
0
            /// <summary>
            /// 对象实体绑定数据
            /// </summary>
            public Lebi_FriendLink ReaderBind(IDataReader dataReader)
            {
                Lebi_FriendLink model = new Lebi_FriendLink();
                object          ojb;

                ojb = dataReader["id"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.id = (int)ojb;
                }
                model.Name = dataReader["Name"].ToString();
                model.Url  = dataReader["Url"].ToString();
                ojb        = dataReader["Sort"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.Sort = (int)ojb;
                }
                model.Logo = dataReader["Logo"].ToString();
                ojb        = dataReader["IsPic"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.IsPic = (int)ojb;
                }
                ojb = dataReader["IsShow"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.IsShow = (int)ojb;
                }
                model.Language     = dataReader["Language"].ToString();
                model.Language_ids = dataReader["Language_ids"].ToString();
                return(model);
            }
Ejemplo n.º 3
0
            /// <summary>
            /// 增加一条数据
            /// </summary>
            public int Add(Lebi_FriendLink model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("insert into [Lebi_FriendLink](");
                strSql.Append("Name,Url,Sort,Logo,IsPic,IsShow,Language,Language_ids)");
                strSql.Append(" values (");
                strSql.Append("@Name,@Url,@Sort,@Logo,@IsPic,@IsShow,@Language,@Language_ids)");
                strSql.Append(";select @@IDENTITY");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@Name",         model.Name),
                    new SqlParameter("@Url",          model.Url),
                    new SqlParameter("@Sort",         model.Sort),
                    new SqlParameter("@Logo",         model.Logo),
                    new SqlParameter("@IsPic",        model.IsPic),
                    new SqlParameter("@IsShow",       model.IsShow),
                    new SqlParameter("@Language",     model.Language),
                    new SqlParameter("@Language_ids", model.Language_ids)
                };

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

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

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

                Lebi_FriendLink model = new Lebi_FriendLink();
                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();
                    model.Url  = ds.Tables[0].Rows[0]["Url"].ToString();
                    if (ds.Tables[0].Rows[0]["Sort"].ToString() != "")
                    {
                        model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString());
                    }
                    model.Logo = ds.Tables[0].Rows[0]["Logo"].ToString();
                    if (ds.Tables[0].Rows[0]["IsPic"].ToString() != "")
                    {
                        model.IsPic = int.Parse(ds.Tables[0].Rows[0]["IsPic"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["IsShow"].ToString() != "")
                    {
                        model.IsShow = int.Parse(ds.Tables[0].Rows[0]["IsShow"].ToString());
                    }
                    model.Language     = ds.Tables[0].Rows[0]["Language"].ToString();
                    model.Language_ids = ds.Tables[0].Rows[0]["Language_ids"].ToString();
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
Ejemplo n.º 5
0
            /// <summary>
            /// 得到一个对象实体 by where条件
            /// </summary>
            public Lebi_FriendLink 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_FriendLink] ");
                strSql.Append(" where " + strWhere + "");
                Lebi_FriendLink model = new Lebi_FriendLink();
                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();
                    model.Url  = ds.Tables[0].Rows[0]["Url"].ToString();
                    if (ds.Tables[0].Rows[0]["Sort"].ToString() != "")
                    {
                        model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString());
                    }
                    model.Logo = ds.Tables[0].Rows[0]["Logo"].ToString();
                    if (ds.Tables[0].Rows[0]["IsPic"].ToString() != "")
                    {
                        model.IsPic = int.Parse(ds.Tables[0].Rows[0]["IsPic"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["IsShow"].ToString() != "")
                    {
                        model.IsShow = int.Parse(ds.Tables[0].Rows[0]["IsShow"].ToString());
                    }
                    model.Language     = ds.Tables[0].Rows[0]["Language"].ToString();
                    model.Language_ids = ds.Tables[0].Rows[0]["Language_ids"].ToString();
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
Ejemplo n.º 6
0
            /// <summary>
            /// 更新一条数据
            /// </summary>
            public void Update(Lebi_FriendLink model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("update [Lebi_FriendLink] set ");
                strSql.Append("Name= @Name,");
                strSql.Append("Url= @Url,");
                strSql.Append("Sort= @Sort,");
                strSql.Append("Logo= @Logo,");
                strSql.Append("IsPic= @IsPic,");
                strSql.Append("IsShow= @IsShow,");
                strSql.Append("Language= @Language,");
                strSql.Append("Language_ids= @Language_ids");
                strSql.Append(" where id=@id");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@id",           SqlDbType.Int,        4),
                    new SqlParameter("@Name",         SqlDbType.NVarChar, 100),
                    new SqlParameter("@Url",          SqlDbType.NVarChar, 200),
                    new SqlParameter("@Sort",         SqlDbType.Int,        4),
                    new SqlParameter("@Logo",         SqlDbType.NVarChar,  50),
                    new SqlParameter("@IsPic",        SqlDbType.Int,        4),
                    new SqlParameter("@IsShow",       SqlDbType.Int,        4),
                    new SqlParameter("@Language",     SqlDbType.NVarChar, 200),
                    new SqlParameter("@Language_ids", SqlDbType.NVarChar, 200)
                };
                parameters[0].Value = model.id;
                parameters[1].Value = model.Name;
                parameters[2].Value = model.Url;
                parameters[3].Value = model.Sort;
                parameters[4].Value = model.Logo;
                parameters[5].Value = model.IsPic;
                parameters[6].Value = model.IsShow;
                parameters[7].Value = model.Language;
                parameters[8].Value = model.Language_ids;

                SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters);
            }
Ejemplo n.º 7
0
            /// <summary>
            /// 增加一条数据
            /// </summary>
            public int Add(Lebi_FriendLink model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("insert into [Lebi_FriendLink](");
                strSql.Append("[Name],[Url],[Sort],[Logo],[IsPic],[IsShow],[Language],[Language_ids])");
                strSql.Append(" values (");
                strSql.Append("@Name,@Url,@Sort,@Logo,@IsPic,@IsShow,@Language,@Language_ids)");
                OleDbParameter[] parameters =
                {
                    new OleDbParameter("@Name",         model.Name),
                    new OleDbParameter("@Url",          model.Url),
                    new OleDbParameter("@Sort",         model.Sort),
                    new OleDbParameter("@Logo",         model.Logo),
                    new OleDbParameter("@IsPic",        model.IsPic),
                    new OleDbParameter("@IsShow",       model.IsShow),
                    new OleDbParameter("@Language",     model.Language),
                    new OleDbParameter("@Language_ids", model.Language_ids)
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
                return(1);
            }
Ejemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = RequestTool.RequestInt("id", 0);

            if (id == 0)
            {
                if (!EX_Admin.Power("friendlink_add", "添加友情链接"))
                {
                    WindowNoPower();
                }
            }
            else
            {
                if (!EX_Admin.Power("friendlink_edit", "编辑友情链接"))
                {
                    WindowNoPower();
                }
            }
            model = B_Lebi_FriendLink.GetModel(id);
            if (model == null)
            {
                model = new Lebi_FriendLink();
            }
        }
Ejemplo n.º 9
0
 /// <summary>
 /// 安全方式绑定对象表单
 /// </summary>
 public Lebi_FriendLink SafeBindForm(Lebi_FriendLink model)
 {
     if (HttpContext.Current.Request["Name"] != null)
     {
         model.Name = Shop.Tools.RequestTool.RequestSafeString("Name");
     }
     if (HttpContext.Current.Request["Url"] != null)
     {
         model.Url = Shop.Tools.RequestTool.RequestSafeString("Url");
     }
     if (HttpContext.Current.Request["Sort"] != null)
     {
         model.Sort = Shop.Tools.RequestTool.RequestInt("Sort", 0);
     }
     if (HttpContext.Current.Request["Logo"] != null)
     {
         model.Logo = Shop.Tools.RequestTool.RequestSafeString("Logo");
     }
     if (HttpContext.Current.Request["IsPic"] != null)
     {
         model.IsPic = Shop.Tools.RequestTool.RequestInt("IsPic", 0);
     }
     if (HttpContext.Current.Request["IsShow"] != null)
     {
         model.IsShow = Shop.Tools.RequestTool.RequestInt("IsShow", 0);
     }
     if (HttpContext.Current.Request["Language"] != null)
     {
         model.Language = Shop.Tools.RequestTool.RequestSafeString("Language");
     }
     if (HttpContext.Current.Request["Language_ids"] != null)
     {
         model.Language_ids = Shop.Tools.RequestTool.RequestSafeString("Language_ids");
     }
     return(model);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static void Update(Lebi_FriendLink model)
 {
     D_Lebi_FriendLink.Instance.Update(model);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static int Add(Lebi_FriendLink model)
 {
     return(D_Lebi_FriendLink.Instance.Add(model));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// 安全方式绑定表单数据
 /// </summary>
 public static Lebi_FriendLink SafeBindForm(Lebi_FriendLink model)
 {
     return(D_Lebi_FriendLink.Instance.SafeBindForm(model));
 }