示例#1
0
 //保存
 protected void btnSave_Click(object sender, EventArgs e)
 {
     DtCms.BLL.Links   bll   = new DtCms.BLL.Links();
     DtCms.Model.Links model = bll.GetModel(this.Id);
     model.Title   = txtTitle.Text.Trim();
     model.WebUrl  = txtWebUrl.Text.Trim();
     model.IsImage = 0;
     if (cbIsImage.Checked == true)
     {
         model.IsImage = 1;
     }
     model.ImgUrl   = txtImgUrl.Text.Trim();
     model.UserName = txtUserName.Text.Trim();
     model.UserTel  = txtUserTel.Text.Trim();
     model.UserMail = txtUserMail.Text.Trim();
     model.SortId   = int.Parse(txtSortId.Text.Trim());
     model.IsRed    = 0;
     model.IsLock   = 0;
     if (cblItem.Items[0].Selected == true)
     {
         model.IsRed = 1;
     }
     if (cblItem.Items[1].Selected == true)
     {
         model.IsLock = 1;
     }
     bll.Update(model);
     JscriptPrint("链接编辑成功啦!", "List.aspx", "Success");
 }
示例#2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(DtCms.Model.Links model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update dt_Links set ");
            strSql.Append("Title=@Title,");
            strSql.Append("UserName=@UserName,");
            strSql.Append("UserTel=@UserTel,");
            strSql.Append("UserMail=@UserMail,");
            strSql.Append("WebUrl=@WebUrl,");
            strSql.Append("ImgUrl=@ImgUrl,");
            strSql.Append("IsImage=@IsImage,");
            strSql.Append("SortId=@SortId,");
            strSql.Append("IsRed=@IsRed,");
            strSql.Append("IsLock=@IsLock,");
            strSql.Append("AddTime=@AddTime");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id",       SqlDbType.Int,        4),
                new SqlParameter("@Title",    SqlDbType.NVarChar,  50),
                new SqlParameter("@UserName", SqlDbType.NVarChar,  20),
                new SqlParameter("@UserTel",  SqlDbType.NVarChar,  30),
                new SqlParameter("@UserMail", SqlDbType.NVarChar,  50),
                new SqlParameter("@WebUrl",   SqlDbType.NVarChar, 250),
                new SqlParameter("@ImgUrl",   SqlDbType.NVarChar, 250),
                new SqlParameter("@IsImage",  SqlDbType.Int,        4),
                new SqlParameter("@SortId",   SqlDbType.Int,        4),
                new SqlParameter("@IsRed",    SqlDbType.Int,        4),
                new SqlParameter("@IsLock",   SqlDbType.Int,        4),
                new SqlParameter("@AddTime",  SqlDbType.DateTime)
            };
            parameters[0].Value  = model.Id;
            parameters[1].Value  = model.Title;
            parameters[2].Value  = model.UserName;
            parameters[3].Value  = model.UserTel;
            parameters[4].Value  = model.UserMail;
            parameters[5].Value  = model.WebUrl;
            parameters[6].Value  = model.ImgUrl;
            parameters[7].Value  = model.IsImage;
            parameters[8].Value  = model.SortId;
            parameters[9].Value  = model.IsRed;
            parameters[10].Value = model.IsLock;
            parameters[11].Value = model.AddTime;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#3
0
文件: Links.cs 项目: xuxiaolei/DTCMS
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public DtCms.Model.Links GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Id,Title,UserName,UserTel,UserMail,WebUrl,ImgUrl,IsImage,IsRed,IsLock,SortId,AddTime from Links ");
            strSql.Append(" where Id=@Id ");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@Id", OleDbType.Integer, 4)
            };
            parameters[0].Value = Id;

            DtCms.Model.Links model = new DtCms.Model.Links();
            DataSet           ds    = DbHelperOleDb.Query(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.Title    = ds.Tables[0].Rows[0]["Title"].ToString();
                model.UserName = ds.Tables[0].Rows[0]["UserName"].ToString();
                model.UserTel  = ds.Tables[0].Rows[0]["UserTel"].ToString();
                model.UserMail = ds.Tables[0].Rows[0]["UserMail"].ToString();
                model.WebUrl   = ds.Tables[0].Rows[0]["WebUrl"].ToString();
                model.ImgUrl   = ds.Tables[0].Rows[0]["ImgUrl"].ToString();
                if (ds.Tables[0].Rows[0]["IsImage"].ToString() != "")
                {
                    model.IsImage = int.Parse(ds.Tables[0].Rows[0]["IsImage"].ToString());
                }
                if (ds.Tables[0].Rows[0]["IsRed"].ToString() != "")
                {
                    model.IsRed = int.Parse(ds.Tables[0].Rows[0]["IsRed"].ToString());
                }
                if (ds.Tables[0].Rows[0]["IsLock"].ToString() != "")
                {
                    model.IsLock = int.Parse(ds.Tables[0].Rows[0]["IsLock"].ToString());
                }
                if (ds.Tables[0].Rows[0]["SortId"].ToString() != "")
                {
                    model.SortId = int.Parse(ds.Tables[0].Rows[0]["SortId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["AddTime"].ToString() != "")
                {
                    model.AddTime = DateTime.Parse(ds.Tables[0].Rows[0]["AddTime"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
示例#4
0
文件: Links.cs 项目: xuxiaolei/DTCMS
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(DtCms.Model.Links model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Links set ");
            strSql.Append("Title=@Title,");
            strSql.Append("UserName=@UserName,");
            strSql.Append("UserTel=@UserTel,");
            strSql.Append("UserMail=@UserMail,");
            strSql.Append("WebUrl=@WebUrl,");
            strSql.Append("ImgUrl=@ImgUrl,");
            strSql.Append("IsImage=@IsImage,");
            strSql.Append("IsRed=@IsRed,");
            strSql.Append("IsLock=@IsLock,");
            strSql.Append("SortId=@SortId,");
            strSql.Append("AddTime=@AddTime");
            strSql.Append(" where Id=@Id ");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@Title",    OleDbType.VarWChar, 100),
                new OleDbParameter("@UserName", OleDbType.VarWChar,  20),
                new OleDbParameter("@UserTel",  OleDbType.VarWChar,  30),
                new OleDbParameter("@UserMail", OleDbType.VarWChar,  30),
                new OleDbParameter("@WebUrl",   OleDbType.VarWChar, 250),
                new OleDbParameter("@ImgUrl",   OleDbType.VarWChar, 250),
                new OleDbParameter("@IsImage",  OleDbType.Integer,    4),
                new OleDbParameter("@IsRed",    OleDbType.Integer,    4),
                new OleDbParameter("@IsLock",   OleDbType.Integer,    4),
                new OleDbParameter("@SortId",   OleDbType.Integer,    4),
                new OleDbParameter("@AddTime",  OleDbType.Date),
                new OleDbParameter("@Id",       OleDbType.Integer, 4)
            };
            parameters[0].Value  = model.Title;
            parameters[1].Value  = model.UserName;
            parameters[2].Value  = model.UserTel;
            parameters[3].Value  = model.UserMail;
            parameters[4].Value  = model.WebUrl;
            parameters[5].Value  = model.ImgUrl;
            parameters[6].Value  = model.IsImage;
            parameters[7].Value  = model.IsRed;
            parameters[8].Value  = model.IsLock;
            parameters[9].Value  = model.SortId;
            parameters[10].Value = model.AddTime;
            parameters[11].Value = model.Id;

            DbHelperOleDb.ExecuteSql(strSql.ToString(), parameters);
        }
示例#5
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(DtCms.Model.Links model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into dt_Links(");
            strSql.Append("Title,UserName,UserTel,UserMail,WebUrl,ImgUrl,IsImage,SortId,IsRed,IsLock,AddTime)");
            strSql.Append(" values (");
            strSql.Append("@Title,@UserName,@UserTel,@UserMail,@WebUrl,@ImgUrl,@IsImage,@SortId,@IsRed,@IsLock,@AddTime)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Title",    SqlDbType.NVarChar,  50),
                new SqlParameter("@UserName", SqlDbType.NVarChar,  20),
                new SqlParameter("@UserTel",  SqlDbType.NVarChar,  30),
                new SqlParameter("@UserMail", SqlDbType.NVarChar,  50),
                new SqlParameter("@WebUrl",   SqlDbType.NVarChar, 250),
                new SqlParameter("@ImgUrl",   SqlDbType.NVarChar, 250),
                new SqlParameter("@IsImage",  SqlDbType.Int,        4),
                new SqlParameter("@SortId",   SqlDbType.Int,        4),
                new SqlParameter("@IsRed",    SqlDbType.Int,        4),
                new SqlParameter("@IsLock",   SqlDbType.Int,        4),
                new SqlParameter("@AddTime",  SqlDbType.DateTime)
            };
            parameters[0].Value  = model.Title;
            parameters[1].Value  = model.UserName;
            parameters[2].Value  = model.UserTel;
            parameters[3].Value  = model.UserMail;
            parameters[4].Value  = model.WebUrl;
            parameters[5].Value  = model.ImgUrl;
            parameters[6].Value  = model.IsImage;
            parameters[7].Value  = model.SortId;
            parameters[8].Value  = model.IsRed;
            parameters[9].Value  = model.IsLock;
            parameters[10].Value = model.AddTime;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
示例#6
0
 //赋值操作
 private void ShowInfo(int _id)
 {
     DtCms.BLL.Links   bll   = new DtCms.BLL.Links();
     DtCms.Model.Links model = bll.GetModel(_id);
     txtTitle.Text  = model.Title;
     txtWebUrl.Text = model.WebUrl;
     if (model.IsImage == 1)
     {
         cbIsImage.Checked = true;
     }
     txtImgUrl.Text   = model.ImgUrl;
     txtUserName.Text = model.UserName;
     txtUserTel.Text  = model.UserTel;
     txtUserMail.Text = model.UserMail;
     if (model.IsRed == 1)
     {
         cblItem.Items[0].Selected = true;
     }
     if (model.IsLock == 1)
     {
         cblItem.Items[1].Selected = true;
     }
     txtSortId.Text = model.SortId.ToString();
 }
示例#7
0
文件: Links.cs 项目: xuxiaolei/DTCMS
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(DtCms.Model.Links model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Links(");
            strSql.Append("Title,UserName,UserTel,UserMail,WebUrl,ImgUrl,IsImage,IsRed,IsLock,SortId,AddTime)");
            strSql.Append(" values (");
            strSql.Append("@Title,@UserName,@UserTel,@UserMail,@WebUrl,@ImgUrl,@IsImage,@IsRed,@IsLock,@SortId,@AddTime)");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@Title",    OleDbType.VarWChar, 100),
                new OleDbParameter("@UserName", OleDbType.VarWChar,  20),
                new OleDbParameter("@UserTel",  OleDbType.VarWChar,  30),
                new OleDbParameter("@UserMail", OleDbType.VarWChar,  30),
                new OleDbParameter("@WebUrl",   OleDbType.VarWChar, 250),
                new OleDbParameter("@ImgUrl",   OleDbType.VarWChar, 250),
                new OleDbParameter("@IsImage",  OleDbType.Integer,    4),
                new OleDbParameter("@IsRed",    OleDbType.Integer,    4),
                new OleDbParameter("@IsLock",   OleDbType.Integer,    4),
                new OleDbParameter("@SortId",   OleDbType.Integer,    4),
                new OleDbParameter("@AddTime",  OleDbType.Date)
            };
            parameters[0].Value  = model.Title;
            parameters[1].Value  = model.UserName;
            parameters[2].Value  = model.UserTel;
            parameters[3].Value  = model.UserMail;
            parameters[4].Value  = model.WebUrl;
            parameters[5].Value  = model.ImgUrl;
            parameters[6].Value  = model.IsImage;
            parameters[7].Value  = model.IsRed;
            parameters[8].Value  = model.IsLock;
            parameters[9].Value  = model.SortId;
            parameters[10].Value = model.AddTime;

            DbHelperOleDb.ExecuteSql(strSql.ToString(), parameters);
        }
        public void ProcessRequest(HttpContext context)
        {
            //取得处事类型
            string action = context.Request.Params["action"];

            //取得站点配置信息
            DtCms.Model.WebSet webset = new DtCms.BLL.WebSet().loadConfig(Utils.GetXmlMapPath("Configpath"));

            //===============================添加友情链接===============================
            if (action == "link")
            {
                string _code     = context.Request.Form["txtCode"];
                string _title    = context.Request.Form["txtTitle"];
                string _username = context.Request.Form["txtUserName"];
                string _usertel  = context.Request.Form["txtUserTel"];
                string _usermail = context.Request.Form["txtUserMail"];
                string _weburl   = context.Request.Form["txtWebUrl"];
                string _imgurl   = context.Request.Form["txtImgUrl"];
                int    _isimage;

                //校检验证码
                if (string.IsNullOrEmpty(_code))
                {
                    context.Response.Write("{msg:0, msgbox:\"对不起,请输入验证码!\"}");
                    return;
                }
                if (context.Session["DtCode"] == null)
                {
                    context.Response.Write("{msg:0, msgbox:\"对不起,系统找不到生成的验证码!\"}");
                    return;
                }
                if (_code.ToLower() != (context.Session["DtCode"].ToString()).ToLower())
                {
                    context.Response.Write("{msg:0, msgbox:\"您输入的验证码与系统的不一致!\"}");
                    return;
                }
                //检查网站标题
                if (string.IsNullOrEmpty(_title))
                {
                    context.Response.Write("{msg:0, msgbox:\"对不起,请输入您要链接的网站标题!\"}");
                    return;
                }
                //检查姓名
                if (string.IsNullOrEmpty(_username))
                {
                    context.Response.Write("{msg:0, msgbox:\"对不起,请输入您的姓名昵称!\"}");
                    return;
                }
                //检查联系电话
                if (string.IsNullOrEmpty(_usertel))
                {
                    context.Response.Write("{msg:0, msgbox:\"对不起,请输入您的联系电话!\"}");
                    return;
                }
                //检查网址
                if (string.IsNullOrEmpty(_weburl))
                {
                    context.Response.Write("{msg:0, msgbox:\"对不起,请输入您网站的网址!\"}");
                    return;
                }
                //检查链接类别
                if (!int.TryParse(context.Request.Form["rblIsImage"] as string, out _isimage))
                {
                    context.Response.Write("对不起,请选择要链接的类别!");
                    return;
                }
                //检查其它项
                if (string.IsNullOrEmpty(_usermail))
                {
                    _usermail = "";
                }
                if (string.IsNullOrEmpty(_imgurl))
                {
                    _imgurl = "";
                }
                //写入数据
                DtCms.Model.Links model = new DtCms.Model.Links();
                DtCms.BLL.Links   bll   = new DtCms.BLL.Links();
                model.Title    = _title.Trim();
                model.UserName = _username.Trim();
                model.UserTel  = _usertel.Trim();
                model.UserMail = _usermail.Trim();
                model.WebUrl   = _weburl.Trim();
                model.ImgUrl   = _imgurl.Trim();
                model.IsImage  = _isimage;
                model.IsLock   = 1;
                bll.Add(model);
                context.Response.Write("{msg:1, msgbox:\"您的链接请求已提交成功,请等待审核通过!\"}");
                return;
            }

            //===============================添加在线留言===============================
            if (action == "feedback")
            {
                string _code     = context.Request.Form["txtCode"];
                string _username = context.Request.Form["txtUserName"];
                string _usertel  = context.Request.Form["txtUserTel"];
                string _userqq   = context.Request.Form["txtUserQQ"];
                string _title    = context.Request.Form["txtTitle"];
                string _content  = context.Request.Form["txtContent"];

                //校检验证码
                if (string.IsNullOrEmpty(_code))
                {
                    context.Response.Write("{msg:0, msgbox:\"对不起,请输入验证码!\"}");
                    return;
                }
                if (context.Session["DtCode"] == null)
                {
                    context.Response.Write("{msg:0, msgbox:\"对不起,系统找不到生成的验证码!\"}");
                    return;
                }
                if (_code.ToLower() != (context.Session["DtCode"].ToString()).ToLower())
                {
                    context.Response.Write("{msg:0, msgbox:\"您输入的验证码与系统的不一致!\"}");
                    return;
                }
                //检查姓名
                if (string.IsNullOrEmpty(_username))
                {
                    context.Response.Write("{msg:0, msgbox:\"对不起,请输入您的昵称!\"}");
                    return;
                }
                //检查输入的标题
                if (string.IsNullOrEmpty(_title))
                {
                    context.Response.Write("{msg:0, msgbox:\"请输入您要留言的标题!\"}");
                    return;
                }
                //检查输入的内容
                if (string.IsNullOrEmpty(_content))
                {
                    context.Response.Write("{msg:0, msgbox:\"请输入您要留言的信息内容!\"}");
                    return;
                }
                //检查其它项
                if (string.IsNullOrEmpty(_usertel))
                {
                    _usertel = "";
                }
                if (string.IsNullOrEmpty(_userqq))
                {
                    _userqq = "";
                }
                //写入数据
                DtCms.Model.Feedback model = new DtCms.Model.Feedback();
                DtCms.BLL.Feedback   bll   = new DtCms.BLL.Feedback();
                model.UserName = _username.Trim();
                model.UserTel  = _usertel.Trim();
                model.UserQQ   = _userqq.Trim();
                model.Title    = _title.Trim();
                model.Content  = Utils.ToHtml(_content);
                model.IsLock   = webset.IsCheckFeedback; //留言是否需要审核
                model.AddTime  = DateTime.Now;
                bll.Add(model);
                context.Response.Write("{msg:1, msgbox:\"您的留言已提交成功,感谢您的支持!\"}");
                return;
            }
        }
示例#9
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(DtCms.Model.Links model)
 {
     return(dal.Update(model));
 }
示例#10
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(DtCms.Model.Links model)
 {
     return(dal.Add(model));
 }