private bool DoAdd()
        {
            bool result = true;
            Model.link model = new Model.link();
            BLL.link bll = new BLL.link();

            model.title = txtTitle.Text.Trim();
            model.is_lock = int.Parse(rblIsLock.SelectedValue);
            model.is_red = int.Parse(rblIsRed.SelectedValue);
            model.sort_id = int.Parse(txtSortId.Text.Trim());
            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) < 1)
            {
                result = false;
            }
            return result;
        }
Exemple #2
0
        private bool DoAdd()
        {
            bool result = false;
            Model.link model = new Model.link();
            BLL.link bll = new BLL.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(DTEnums.ActionEnum.Add.ToString(), "添加友情链接:" + model.title); //记录日志
                result = true;
            }
            return result;
        }
Exemple #3
0
        private bool DoAdd()
        {
            bool result = false;

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

            model.site_id = int.Parse(ddlSiteId.SelectedValue);
            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(DTEnums.ActionEnum.Add.ToString(), "添加友情链接:" + model.title); //记录日志
                result = true;
            }
            return(result);
        }
Exemple #4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.link model)
 {
     return(dal.Update(model));
 }
Exemple #5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Model.link model)
 {
     return(dal.Add(model));
 }
Exemple #6
0
        private void link_add(HttpContext context)
        {
            StringBuilder strTxt = new StringBuilder();

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

            string _site_path = DTRequest.GetQueryString("site");
            string _code      = DTRequest.GetFormString("txtCode");
            string _title     = DTRequest.GetFormString("txtTitle");
            string _user_name = DTRequest.GetFormString("txtUserName");
            string _user_tel  = DTRequest.GetFormString("txtUserTel");
            string _email     = DTRequest.GetFormString("txtEmail");
            string _site_url  = DTRequest.GetFormString("txtSiteUrl");
            string _img_url   = DTRequest.GetFormString("txtImgUrl");

            //检查站点目录
            if (string.IsNullOrEmpty(_site_path))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,网站传输参数有误!\"}");
                return;
            }
            //校检验证码
            if (string.IsNullOrEmpty(_code))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请输入验证码!\"}");
                return;
            }
            if (context.Session[DTKeys.SESSION_CODE] == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,系验证码已过期!\"}");
                return;
            }
            if (_code.ToLower() != (context.Session[DTKeys.SESSION_CODE].ToString()).ToLower())
            {
                context.Response.Write("{\"status\":0, \"msg\":\"验证码与系统的不一致!\"}");
                return;
            }
            if (string.IsNullOrEmpty(_title))
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"对不起,请输入网站标题!\"}");
                return;
            }
            if (string.IsNullOrEmpty(_site_url))
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"对不起,请输入网站网址!\"}");
                return;
            }
            model.site_path = Utils.DropHTML(_site_path);
            model.title     = Utils.DropHTML(_title);
            model.is_lock   = 1;
            model.is_red    = 0;
            model.user_name = Utils.DropHTML(_user_name);
            model.user_tel  = Utils.DropHTML(_user_tel);
            model.email     = Utils.DropHTML(_email);
            model.site_url  = Utils.DropHTML(_site_url);
            model.img_url   = Utils.DropHTML(_img_url);
            model.is_image  = 1;
            if (string.IsNullOrEmpty(model.img_url))
            {
                model.is_image = 0;
            }
            if (bll.Add(model) > 0)
            {
                context.Response.Write("{\"status\": 1, \"msg\": \"恭喜您,提交成功!\"}");
                return;
            }
            context.Response.Write("{\"status\": 0, \"msg\": \"对不起,保存过程中发生错误!\"}");
            return;
        }
Exemple #7
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.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 dt_link ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            Model.link model = new Model.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);
            }
        }
Exemple #8
0
        /// <summary>
        /// �õ�һ������ʵ��
        /// </summary>
        public Model.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.link model=new Model.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;
            }
        }