예제 #1
0
        private bool DoAdd()
        {
            bool result = false;
            Model.plugins.link model = new Model.plugins.link();
            BLL.plugins.link bll = new BLL.plugins.link();

            model.title = txtTitle.Text.Trim();
            model.is_lock = Utils.StrToInt(rblIsLock.SelectedValue, 0);
            if (cbIsRed.Checked == true)
            {
                model.is_red = 1;
            }
            else
            {
                model.is_red = 0;
            }
            model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99);
            model.user_name = txtUserName.Text.Trim();
            model.user_tel = txtUserTel.Text.Trim();
            model.email = txtEmail.Text.Trim();
            model.site_url = txtSiteUrl.Text.Trim();
            model.img_url = txtImgUrl.Text.Trim();
            model.is_image = 1;
            if (string.IsNullOrEmpty(model.img_url))
            {
                model.is_image = 0;
            }
            if (bll.Add(model) > 0)
            {
                AddAdminLog(OSEnums.ActionEnum.Add.ToString(), "添加友情链接:" + model.title); //记录日志
                result = true;
            }
            return result;
        }
예제 #2
0
        private bool DoAdd()
        {
            bool result = false;

            Model.plugins.link model = new Model.plugins.link();
            BLL.plugins.link   bll   = new BLL.plugins.link();

            model.title   = txtTitle.Text.Trim();
            model.is_lock = Utils.StrToInt(rblIsLock.SelectedValue, 0);
            if (cbIsRed.Checked == true)
            {
                model.is_red = 1;
            }
            else
            {
                model.is_red = 0;
            }
            model.sort_id   = Utils.StrToInt(txtSortId.Text.Trim(), 99);
            model.user_name = txtUserName.Text.Trim();
            model.user_tel  = txtUserTel.Text.Trim();
            model.email     = txtEmail.Text.Trim();
            model.site_url  = txtSiteUrl.Text.Trim();
            model.img_url   = txtImgUrl.Text.Trim();
            model.is_image  = 1;
            if (string.IsNullOrEmpty(model.img_url))
            {
                model.is_image = 0;
            }
            if (bll.Add(model) > 0)
            {
                AddAdminLog(OSEnums.ActionEnum.Add.ToString(), "添加友情链接:" + model.title); //记录日志
                result = true;
            }
            return(result);
        }
예제 #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.plugins.link model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update " + databaseprefix + "link set ");
            strSql.Append("title=@title,");
            strSql.Append("user_name=@user_name,");
            strSql.Append("user_tel=@user_tel,");
            strSql.Append("email=@email,");
            strSql.Append("site_url=@site_url,");
            strSql.Append("img_url=@img_url,");
            strSql.Append("is_image=@is_image,");
            strSql.Append("sort_id=@sort_id,");
            strSql.Append("is_red=@is_red,");
            strSql.Append("is_lock=@is_lock,");
            strSql.Append("add_time=@add_time");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@title",     SqlDbType.NVarChar,  255),
                new SqlParameter("@user_name", SqlDbType.NVarChar,   50),
                new SqlParameter("@user_tel",  SqlDbType.NVarChar,   20),
                new SqlParameter("@email",     SqlDbType.NVarChar,   50),
                new SqlParameter("@site_url",  SqlDbType.NVarChar,  255),
                new SqlParameter("@img_url",   SqlDbType.NVarChar,  255),
                new SqlParameter("@is_image",  SqlDbType.Int,         4),
                new SqlParameter("@sort_id",   SqlDbType.Int,         4),
                new SqlParameter("@is_red",    SqlDbType.TinyInt,     1),
                new SqlParameter("@is_lock",   SqlDbType.TinyInt,     1),
                new SqlParameter("@add_time",  SqlDbType.DateTime),
                new SqlParameter("@id",        SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.title;
            parameters[1].Value  = model.user_name;
            parameters[2].Value  = model.user_tel;
            parameters[3].Value  = model.email;
            parameters[4].Value  = model.site_url;
            parameters[5].Value  = model.img_url;
            parameters[6].Value  = model.is_image;
            parameters[7].Value  = model.sort_id;
            parameters[8].Value  = model.is_red;
            parameters[9].Value  = model.is_lock;
            parameters[10].Value = model.add_time;
            parameters[11].Value = model.id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.plugins.link model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into " + databaseprefix + "link(");
            strSql.Append("title,user_name,user_tel,email,site_url,img_url,is_image,sort_id,is_red,is_lock,add_time)");
            strSql.Append(" values (");
            strSql.Append("@title,@user_name,@user_tel,@email,@site_url,@img_url,@is_image,@sort_id,@is_red,@is_lock,@add_time)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@title",     SqlDbType.NVarChar, 255),
                new SqlParameter("@user_name", SqlDbType.NVarChar,  50),
                new SqlParameter("@user_tel",  SqlDbType.NVarChar,  20),
                new SqlParameter("@email",     SqlDbType.NVarChar,  50),
                new SqlParameter("@site_url",  SqlDbType.NVarChar, 255),
                new SqlParameter("@img_url",   SqlDbType.NVarChar, 255),
                new SqlParameter("@is_image",  SqlDbType.Int,        4),
                new SqlParameter("@sort_id",   SqlDbType.Int,        4),
                new SqlParameter("@is_red",    SqlDbType.TinyInt,    1),
                new SqlParameter("@is_lock",   SqlDbType.TinyInt,    1),
                new SqlParameter("@add_time",  SqlDbType.DateTime)
            };
            parameters[0].Value  = model.title;
            parameters[1].Value  = model.user_name;
            parameters[2].Value  = model.user_tel;
            parameters[3].Value  = model.email;
            parameters[4].Value  = model.site_url;
            parameters[5].Value  = model.img_url;
            parameters[6].Value  = model.is_image;
            parameters[7].Value  = model.sort_id;
            parameters[8].Value  = model.is_red;
            parameters[9].Value  = model.is_lock;
            parameters[10].Value = model.add_time;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
예제 #5
0
파일: list.aspx.cs 프로젝트: eryueren/OScms
        //设置操作
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            ChkAdminLevel("plugin_link", OSEnums.ActionEnum.Edit.ToString()); //检查权限
            int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value);

            BLL.plugins.link   bll   = new BLL.plugins.link();
            Model.plugins.link model = bll.GetModel(id);
            switch (e.CommandName.ToLower())
            {
            case "lbtnisred":
                if (model.is_red == 1)
                {
                    bll.UpdateField(id, "is_red=0");
                }
                else
                {
                    bll.UpdateField(id, "is_red=1");
                }
                break;
            }
            this.RptBind("id>0" + CombSqlTxt(this.keywords), "sort_id asc,add_time desc");
        }
예제 #6
0
        private void ShowInfo(int _id)
        {
            BLL.plugins.link   bll   = new BLL.plugins.link();
            Model.plugins.link model = bll.GetModel(_id);

            txtTitle.Text = model.title;
            if (model.is_red == 1)
            {
                cbIsRed.Checked = true;
            }
            else
            {
                cbIsRed.Checked = false;
            }
            rblIsLock.SelectedValue = model.is_lock.ToString();
            txtSortId.Text          = model.sort_id.ToString();
            txtUserName.Text        = model.user_name;
            txtUserTel.Text         = model.user_tel;
            txtEmail.Text           = model.email;
            txtSiteUrl.Text         = model.site_url;
            txtImgUrl.Text          = model.img_url;
        }
예제 #7
0
파일: link.cs 프로젝트: eryueren/OScms
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.plugins.link model)
 {
     return(dal.Update(model));
 }
예제 #8
0
파일: link.cs 프로젝트: eryueren/OScms
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Model.plugins.link model)
 {
     return(dal.Add(model));
 }
예제 #9
0
파일: link.cs 프로젝트: eyren/OScms
        /// <summary>
        /// �õ�һ������ʵ��
        /// </summary>
        public Model.plugins.link GetModel(int id)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 id,title,user_name,user_tel,email,site_url,img_url,is_image,sort_id,is_red,is_lock,add_time from " + databaseprefix + "link ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int,4)};
            parameters[0].Value = id;

            Model.plugins.link model = new Model.plugins.link();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                if(ds.Tables[0].Rows[0]["id"]!=null && ds.Tables[0].Rows[0]["id"].ToString()!="")
                {
                    model.id=int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if(ds.Tables[0].Rows[0]["title"]!=null && ds.Tables[0].Rows[0]["title"].ToString()!="")
                {
                    model.title=ds.Tables[0].Rows[0]["title"].ToString();
                }
                if(ds.Tables[0].Rows[0]["user_name"]!=null && ds.Tables[0].Rows[0]["user_name"].ToString()!="")
                {
                    model.user_name=ds.Tables[0].Rows[0]["user_name"].ToString();
                }
                if(ds.Tables[0].Rows[0]["user_tel"]!=null && ds.Tables[0].Rows[0]["user_tel"].ToString()!="")
                {
                    model.user_tel=ds.Tables[0].Rows[0]["user_tel"].ToString();
                }
                if(ds.Tables[0].Rows[0]["email"]!=null && ds.Tables[0].Rows[0]["email"].ToString()!="")
                {
                    model.email=ds.Tables[0].Rows[0]["email"].ToString();
                }
                if(ds.Tables[0].Rows[0]["site_url"]!=null && ds.Tables[0].Rows[0]["site_url"].ToString()!="")
                {
                    model.site_url=ds.Tables[0].Rows[0]["site_url"].ToString();
                }
                if(ds.Tables[0].Rows[0]["img_url"]!=null && ds.Tables[0].Rows[0]["img_url"].ToString()!="")
                {
                    model.img_url=ds.Tables[0].Rows[0]["img_url"].ToString();
                }
                if(ds.Tables[0].Rows[0]["is_image"]!=null && ds.Tables[0].Rows[0]["is_image"].ToString()!="")
                {
                    model.is_image=int.Parse(ds.Tables[0].Rows[0]["is_image"].ToString());
                }
                if(ds.Tables[0].Rows[0]["sort_id"]!=null && ds.Tables[0].Rows[0]["sort_id"].ToString()!="")
                {
                    model.sort_id=int.Parse(ds.Tables[0].Rows[0]["sort_id"].ToString());
                }
                if(ds.Tables[0].Rows[0]["is_red"]!=null && ds.Tables[0].Rows[0]["is_red"].ToString()!="")
                {
                    model.is_red=int.Parse(ds.Tables[0].Rows[0]["is_red"].ToString());
                }
                if(ds.Tables[0].Rows[0]["is_lock"]!=null && ds.Tables[0].Rows[0]["is_lock"].ToString()!="")
                {
                    model.is_lock=int.Parse(ds.Tables[0].Rows[0]["is_lock"].ToString());
                }
                if(ds.Tables[0].Rows[0]["add_time"]!=null && ds.Tables[0].Rows[0]["add_time"].ToString()!="")
                {
                    model.add_time=DateTime.Parse(ds.Tables[0].Rows[0]["add_time"].ToString());
                }
                return model;
            }
            else
            {
                return null;
            }
        }
예제 #10
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.plugins.link GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,title,user_name,user_tel,email,site_url,img_url,is_image,sort_id,is_red,is_lock,add_time from " + databaseprefix + "link ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            Model.plugins.link model = new Model.plugins.link();
            DataSet            ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["title"] != null && ds.Tables[0].Rows[0]["title"].ToString() != "")
                {
                    model.title = ds.Tables[0].Rows[0]["title"].ToString();
                }
                if (ds.Tables[0].Rows[0]["user_name"] != null && ds.Tables[0].Rows[0]["user_name"].ToString() != "")
                {
                    model.user_name = ds.Tables[0].Rows[0]["user_name"].ToString();
                }
                if (ds.Tables[0].Rows[0]["user_tel"] != null && ds.Tables[0].Rows[0]["user_tel"].ToString() != "")
                {
                    model.user_tel = ds.Tables[0].Rows[0]["user_tel"].ToString();
                }
                if (ds.Tables[0].Rows[0]["email"] != null && ds.Tables[0].Rows[0]["email"].ToString() != "")
                {
                    model.email = ds.Tables[0].Rows[0]["email"].ToString();
                }
                if (ds.Tables[0].Rows[0]["site_url"] != null && ds.Tables[0].Rows[0]["site_url"].ToString() != "")
                {
                    model.site_url = ds.Tables[0].Rows[0]["site_url"].ToString();
                }
                if (ds.Tables[0].Rows[0]["img_url"] != null && ds.Tables[0].Rows[0]["img_url"].ToString() != "")
                {
                    model.img_url = ds.Tables[0].Rows[0]["img_url"].ToString();
                }
                if (ds.Tables[0].Rows[0]["is_image"] != null && ds.Tables[0].Rows[0]["is_image"].ToString() != "")
                {
                    model.is_image = int.Parse(ds.Tables[0].Rows[0]["is_image"].ToString());
                }
                if (ds.Tables[0].Rows[0]["sort_id"] != null && ds.Tables[0].Rows[0]["sort_id"].ToString() != "")
                {
                    model.sort_id = int.Parse(ds.Tables[0].Rows[0]["sort_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["is_red"] != null && ds.Tables[0].Rows[0]["is_red"].ToString() != "")
                {
                    model.is_red = int.Parse(ds.Tables[0].Rows[0]["is_red"].ToString());
                }
                if (ds.Tables[0].Rows[0]["is_lock"] != null && ds.Tables[0].Rows[0]["is_lock"].ToString() != "")
                {
                    model.is_lock = int.Parse(ds.Tables[0].Rows[0]["is_lock"].ToString());
                }
                if (ds.Tables[0].Rows[0]["add_time"] != null && ds.Tables[0].Rows[0]["add_time"].ToString() != "")
                {
                    model.add_time = DateTime.Parse(ds.Tables[0].Rows[0]["add_time"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }