Пример #1
0
        private bool BindList()
        {
            bool ifOk = true;

            int pageIndex   = 1;
            int pageSize    = 30;//pager.PageSize;//每页显示20条信息
            int totalRecord = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["p"]) && MetarnetRegex.IsNumeric(Request.QueryString["p"]))
            {
                pageIndex = Convert.ToInt32(InText.SafeSql(InText.SafeStr(Request.QueryString["p"].ToString())));
            }

            string where = " where 1=1";

            if (html.Trim() != "")
            {
                where += " and html like '%" + html + "%'";
            }
            if (update_date_min != "")
            {
                where += " and  DateDiff( day,  '" + update_date_min + "',t_article_pic.update_date) >=0 ";
            }
            if (update_date_max != "")
            {
                where += " and  DateDiff( day,  '" + update_date_max + "',t_article_pic.update_date) <=0 ";
            }


            string strSql = " Select t_article_pic.id as pic_id,t_article.title,t_article.html,t_article_pic.pic,t_article_pic.update_date   "
                            + " ,row_number() over(order by t_article_pic.id desc) as rowNumber "
                            + " FROM t_article_pic "
                            + " LEFT JOIN t_article ON t_article_pic.article_id=t_article.id ";
            DataTable dt = artBll.ExecutePager(strSql + where, pageSize, pageIndex, ref totalRecord);

            if (dt.Rows.Count > 0)
            {
                ifOk = true;

                pager.PageSize              = pageSize;
                pager.RecordCount           = totalRecord;
                this.repList_Img.DataSource = dt;
                this.repList_Img.DataBind();

                this.labInfoCount.Text = totalRecord.ToString();

                if (totalRecord <= pageSize)//只有一页,隐藏分页控件
                {
                    this.divFenye.Visible = false;
                }
            }
            else
            {
                this.divFenye.Visible = false;
                ifOk = false;
            }
            return(ifOk);
        }
Пример #2
0
        int articleId = 0;            //图片对应的文章ID
        protected void Page_Load(object sender, EventArgs e)
        {
            adminId = new AdminMethod().CheckAdminLogin();//-----------------------------

            if (!string.IsNullOrEmpty(Request.QueryString["a_id"]) && MetarnetRegex.IsNumeric(Request.QueryString["a_id"]))
            {
                articleId = Utils.CheckInt(Request.QueryString["a_id"]);
            }

            if (articleId != 0)
            {
                string artPic   = "";
                string fileName = "";
                if (Request.Files.Count > 0)
                {
                    fileName = Request.Files[0].FileName;
                    fileName = Server.UrlDecode(fileName);

                    string aLastName = fileName.Substring(fileName.LastIndexOf(".") + 1, (fileName.Length - fileName.LastIndexOf(".") - 1));//扩展名


                    if (aLastName.Trim().ToLower() == "gif")
                    {
                        artPic = imageNamePre + DateTime.Now.ToString("yyyyMMddHHmmss") + Guid.NewGuid().ToString("N") + ".gif";
                    }
                    else
                    {
                        artPic = imageNamePre + DateTime.Now.ToString("yyyyMMddHHmmss") + Guid.NewGuid().ToString("N") + ".jpg";
                    }

                    Request.Files[0].SaveAs(savePath + artPic);
                }
                else
                {
                    System.Drawing.Image img = System.Drawing.Image.FromStream(Request.InputStream);
                    fileName = Request.Headers["fileName"];
                    fileName = Server.UrlDecode(fileName);

                    string aLastName = fileName.Substring(fileName.LastIndexOf(".") + 1, (fileName.Length - fileName.LastIndexOf(".") - 1));//扩展名


                    if (aLastName.Trim().ToLower() == "gif")
                    {
                        artPic = imageNamePre + DateTime.Now.ToString("yyyyMMddHHmmss") + Guid.NewGuid().ToString("N") + ".gif";
                    }
                    else
                    {
                        artPic = imageNamePre + DateTime.Now.ToString("yyyyMMddHHmmss") + Guid.NewGuid().ToString("N") + ".jpg";
                    }

                    img.Save(savePath + artPic);
                }
                //string sql = string.Format("insert into t_article_pic (article_id,pic,update_date,remark) values ({0},'{1}',now(),'{2}')", articleId, artPic, "");

                //bool isOk = artBll.ExecuteSQLNonquery(sql);
            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            adminId = new AdminMethod().CheckAdminLogin();//-----------------------------

            if (!string.IsNullOrEmpty(Request.QueryString["t_id"]) && MetarnetRegex.IsNumeric(Request.QueryString["t_id"]))
            {
                tag_id = Utils.CheckInt(Request.QueryString["t_id"]);
            }

            if (!IsPostBack)
            {
                if (tag_id != 0)
                {
                    SelectTagInfo();
                }
            }
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            adminId = new AdminMethod().CheckAdminLogin();//-----------------------------

            if (!string.IsNullOrEmpty(Request.QueryString["admin_id"]) && MetarnetRegex.IsNumeric(Request.QueryString["admin_id"]))
            {
                admin_id = Convert.ToInt32(Request.QueryString["admin_id"].ToString());
            }

            if (!Page.IsPostBack)
            {
                if (admin_id != 0)
                {
                    InitAdminInfo();//初始化人员信息
                }
            }
        }
 private void textBox2_Leave(object sender, EventArgs e)
 {
     if (MetarnetRegex.IsUint(textBox2.Text))
     {
         if (Convert.ToInt32(textBox2.Text) > 1 && Convert.ToDouble(textBox2.Text) <= 20)
         {
             textBox2.Text = textBox2.Text;
         }
         else
         {
             textBox2.Text = "";
             MessageBox.Show("请输入2到20之前的整数");
         }
     }
     else
     {
         textBox2.Text = "";
         MessageBox.Show("请输入整数");
     }
 }
 private void textBox1_Leave(object sender, EventArgs e)
 {
     if (MetarnetRegex.IsNumber(textBox1.Text))
     {
         if (Convert.ToDouble(textBox1.Text) > 0 && Convert.ToDouble(textBox1.Text) < 180)
         {
             textBox1.Text = textBox1.Text;
         }
         else
         {
             textBox1.Text = "";
             MessageBox.Show("请输入0到180之前的数字");
         }
     }
     else
     {
         textBox1.Text = "";
         MessageBox.Show("请输入数字");
     }
 }
Пример #7
0
        private bool BindList()
        {
            bool ifOk = true;

            int pageIndex   = 1;
            int pageSize    = 100;//pager.PageSize;//每页显示20条信息
            int totalRecord = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["p"]) && MetarnetRegex.IsNumeric(Request.QueryString["p"]))
            {
                pageIndex = Convert.ToInt32(InText.SafeSql(InText.SafeStr(Request.QueryString["p"].ToString())));
            }

            string    strSql = " Select id,tag_name,tag_keyword,article_num  " + " ,row_number() over(order by t_tag.article_num desc ) as rowNumber " + " FROM t_tag where t_tag.article_num>0 ";
            DataTable dt     = artBll.ExecutePager(strSql, pageSize, pageIndex, ref totalRecord);

            if (dt.Rows.Count > 0)
            {
                ifOk = true;

                pager.PageSize          = pageSize;
                pager.RecordCount       = totalRecord;
                this.repList.DataSource = dt;
                this.repList.DataBind();

                //this.labInfoCount.Text = totalRecord.ToString();

                if (totalRecord <= pageSize)//只有一页,隐藏分页控件
                {
                    this.divFenye.Visible = false;
                }
            }
            else
            {
                this.divFenye.Visible = false;
                ifOk = false;
            }
            return(ifOk);
        }
Пример #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string host = HttpContext.Current.Request.Url.Host.ToString();

            if (!host.Contains(".up927.com"))
            {
                Response.Redirect("http://www.up927.com/");
            }
            else if (host.Contains("vhye.pw"))
            {
                Response.Redirect("http://www.up927.com/");
            }

            if (!string.IsNullOrEmpty(Request.QueryString["a_t"]) && MetarnetRegex.IsNumeric(Request.QueryString["a_t"]))
            {
                articleType = Utils.CheckInt(Request.QueryString["a_t"].ToString());

                string    sql    = "select type_name,type_keyword from t_article_type where id=" + articleType;
                DataTable dtType = artBll.SelectToDataTable(sql);
                if (dtType.Rows.Count > 0)
                {
                    articleTypeName = dtType.Rows[0]["type_name"].ToString();
                    html_title      = articleTypeName + "_" + html_title;
                }
            }
            if (!string.IsNullOrEmpty(Request.QueryString["tag"]))
            {
                tag_id = (Utils.CheckInt(Request.QueryString["tag"].ToString()));
                if (tag_id != 0)
                {
                    tagName         = this.SelectOneTagName(tag_id.ToString());
                    html_title      = tagName + "_" + html_title;
                    articleTypeName = tagName;
                }
            }

            BindList();//绑定列表
        }
Пример #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            adminId = new AdminMethod().CheckAdminLogin();//-----------------------------

            if (!string.IsNullOrEmpty(Request.QueryString["a_id"]) && MetarnetRegex.IsNumeric(Request.QueryString["a_id"]))
            {
                articleId = Utils.CheckInt(Request.QueryString["a_id"]);
            }
            //articleId = 0;//-------------------------
            if (articleId == 0)
            {
                string    sql     = "select max(id) as maxId from t_article";
                DataTable dtMaxId = artBll.SelectToDataTable(sql);
                if (dtMaxId.Rows.Count > 0)
                {
                    articleId_img = Convert.ToInt32(dtMaxId.Rows[0]["maxId"]) + 1;

                    ////文章分类默认为与上一篇文章相同
                    //sql = "select * from t_article where id=" + dtMaxId.Rows[0]["maxId"].ToString();
                    //dtMaxId = artBll.SelectToDataTable(sql);
                    //if (dtMaxId.Rows.Count > 0)
                    //{
                    //    this.ddl_articleType.SelectedValue = dtMaxId.Rows[0]["type"].ToString();
                    //}
                }
            }
            else
            {
                articleId_img = articleId;
            }

            if (!IsPostBack)
            {
                InitArticle();
                InitImg();
            }
        }
Пример #10
0
        /// <summary>
        /// 验证记录仪系统设置选项卡输入是否正确
        /// </summary>
        private bool ValidateSysSetInput(out string msg)
        {
            bool ok;

            msg = string.Empty;

            ok = MetarnetRegex.IsTime(txtComTime_T.Text);
            if (!ok)
            {
                txtComTime_T.Focus();
                txtComTime_T.SelectAll();
                msg = "通讯时间设置错误!";
                return(ok);
            }
            ok = MetarnetRegex.IsTime(txtRecTime_T.Text);
            if (!ok)
            {
                txtRecTime_T.Focus();
                txtRecTime_T.SelectAll();
                msg = "记录时间设置错误!";
                return(ok);
            }
            ok = MetarnetRegex.IsUint(txtLeakValue_T.Text);
            if (!ok)
            {
                txtLeakValue_T.Focus();
                txtLeakValue_T.SelectAll();
                msg = "报漏幅度值设置错误!";
                return(ok);
            }

            ok = MetarnetRegex.IsUint(txtConPort_T.Text);
            if (!ok)
            {
                txtConPort_T.Focus();
                txtConPort_T.SelectAll();
                msg = "远传端口设置错误!";
                return(ok);
            }
            ok = MetarnetRegex.IsIPv4(txtConAdree_T.Text);
            if (!ok)
            {
                txtConAdree_T.Focus();
                txtConAdree_T.SelectAll();
                msg = "远传地址设置错误!";
                return(ok);
            }

            // 通讯时间与记录时间不能重叠
            int comTime  = Convert.ToInt32(txtComTime_T.Text);
            int recTime1 = Convert.ToInt32(txtRecTime_T.Text);
            int recTime2 = Convert.ToInt32(txtRecTime1_T.Text);

            if (comTime == recTime1 || comTime == recTime2 || (comTime > recTime1 && comTime < recTime2))
            {
                txtComTime_T.Focus();
                txtComTime_T.SelectAll();
                msg = "通讯时间/记录时间设置重叠!";
                return(false);
            }

            return(ok);
        }
Пример #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            adminId = new AdminMethod().CheckAdminLogin();//-----------------------------

            if (!IsPostBack)
            {
                InitArticle();
            }

            if (!string.IsNullOrEmpty(Request.QueryString["a_id"]) && MetarnetRegex.IsNumeric(Request.QueryString["a_id"]))
            {
                articleId = Utils.CheckInt(Request.QueryString["a_id"].ToString());
                this.txt_article_id.Value = InText.SafeSql(InText.SafeStr(Request.QueryString["a_id"].ToString()));
            }
            if (!string.IsNullOrEmpty(Request.QueryString["title"]))
            {
                title = InText.SafeStr(Request.QueryString["title"].ToString());
                this.txt_title.Value = title;
            }
            if (!string.IsNullOrEmpty(Request.QueryString["search_keyword"]))
            {
                search_keyword = InText.SafeStr(Request.QueryString["search_keyword"].ToString());
                this.txt_search_keyword.Value = title;
            }
            if (!string.IsNullOrEmpty(Request.QueryString["a_t"]) && MetarnetRegex.IsNumeric(Request.QueryString["a_t"]))
            {
                articleType = Utils.CheckInt(Request.QueryString["a_t"].ToString());
                this.ddl_articleType.SelectedValue = InText.SafeStr(Request.QueryString["a_t"].ToString());
            }

            if (!string.IsNullOrEmpty(Request.QueryString["dateMin"]))
            {
                update_date_min = InText.SafeSql(InText.SafeStr(Request.QueryString["dateMin"].ToString()));
                this.txt_update_date_min.Value = update_date_min;
            }
            if (!string.IsNullOrEmpty(Request.QueryString["dateMax"]))
            {
                update_date_max = InText.SafeSql(InText.SafeStr(Request.QueryString["dateMax"].ToString()));
                this.txt_update_date_max.Value = update_date_max;
            }

            if (!string.IsNullOrEmpty(Request.QueryString["tag"]))
            {
                tag = InText.SafeStr(Request.QueryString["tag"].ToString());
                this.txt_tag.Value = tag;
            }
            if (!string.IsNullOrEmpty(Request.QueryString["html"]))
            {
                html = InText.SafeStr(Request.QueryString["html"].ToString());
                this.txt_html.Value = html;
            }
            if (!string.IsNullOrEmpty(Request.QueryString["hd1"]) && MetarnetRegex.IsNumeric(Request.QueryString["hd1"]))
            {
                isHuandeng1 = Utils.CheckInt(Request.QueryString["hd1"].ToString());
                this.chkIsHuandeng1.Checked = true;
            }

            if (!string.IsNullOrEmpty(Request.QueryString["r_t"]) && MetarnetRegex.IsNumeric(Request.QueryString["r_t"]))
            {
                right_type = Utils.CheckInt(Request.QueryString["r_t"].ToString());
                this.ddl_right_type.SelectedValue = InText.SafeStr(Request.QueryString["r_t"].ToString());
            }

            if (!IsPostBack)
            {
                BindList();//绑定列表
            }
        }
Пример #12
0
        /// <summary>
        /// 发送手机验证码
        /// </summary>
        /// <param name="telPhone">手机号码</param>
        /// <param name="note">提示消息</param>
        public static string GetTelphoneCode(string telPhone, string note)
        {
            string resStrCode = string.Empty;

            if (MetarnetRegex.IsMobilePhone(telPhone))
            {
                DB.Model.M_TelPhoneCode newTelCode = new DB.BLL.MY_Bll(DBEnum.Slave).GetModel <DB.Model.M_TelPhoneCode>("Telphone=@_Telphone", new { _Telphone = telPhone });
                int randomCode = new Random().Next(100000, 999999);//随机生成6位数的随机数
                if (newTelCode == null)
                {
                    newTelCode            = new DB.Model.M_TelPhoneCode();
                    newTelCode.Telphone   = telPhone;
                    newTelCode.Code       = randomCode.ToString();
                    newTelCode.CreatTime  = DateTime.Now;
                    newTelCode.LoginTimes = 0;
                    if (new DB.BLL.MY_Bll(DBEnum.Master).AddModel(newTelCode))
                    {
                        string smsurl = "http://utf8.sms.webchinese.cn/?";
                        smsurl += "Uid=llkj&Key=llkjbyflood&";
                        smsurl += "smsMob=" + telPhone + "&smsText=" + note + ",您的验证码:" + randomCode;
                        string resStr = string.Empty;
                        if (SendSMS.GetHtmlFromUrl(smsurl, out resStr))
                        {
                            resStrCode = "SUCCESS";
                        }
                        else
                        {
                            resStrCode = "ERR,发送失败,请重试";
                            ToolHelper.WriteLogInfoToLocalText(resStr);
                        }
                    }
                    else
                    {
                        resStrCode = "ERR,发送失败,请重试";
                    }
                }
                else//数据库已经存在这条数据
                {
                    if (DateTime.Now < newTelCode.CreatTime.AddMinutes(1))//间隔时间小于1分钟
                    {
                        resStrCode = "ERR,获取验证码的时间间隔为1分钟";
                    }
                    else
                    {
                        newTelCode.Code       = randomCode.ToString();
                        newTelCode.CreatTime  = DateTime.Now;
                        newTelCode.LoginTimes = 0;//更新验证码的时候归零次数
                        if (new DB.BLL.MY_Bll(DBEnum.Master).UpdateModel <DB.Model.M_TelPhoneCode>(" Telphone=@Telphone ", newTelCode))
                        {
                            string smsurl = "http://utf8.sms.webchinese.cn/?";
                            smsurl += "Uid=llkj&Key=llkjbyflood&";
                            smsurl += "smsMob=" + telPhone + "&smsText=" + note + ",您的验证码:" + randomCode;
                            string resStr = string.Empty;
                            if (SendSMS.GetHtmlFromUrl(smsurl, out resStr))
                            {
                                resStrCode = "SUCCESS";
                            }
                            else
                            {
                                resStrCode = "ERR,发送失败,请重试";
                            }
                        }
                        else
                        {
                            resStrCode = "ERR,发送失败,请重试";
                        }
                    }
                }
            }
            else
            {
                resStrCode = "提示:不是合法的手机号码";
            }
            return(resStrCode);
        }
Пример #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CommonMethod.ValidUrl();

            if (!string.IsNullOrEmpty(Request.QueryString["title"]))
            {
                title       = InText.SafeSql(InText.SafeStr(Request.QueryString["title"].ToString()));
                tishi       = "“" + title + "”的搜索结果";
                html_title  = "“" + title + "”" + "的搜索结果_好宝宝早教网";
                description = "好宝宝早教网为您提供有关" + title + "_" + @ConfigurationManager.AppSettings["title"].ToString() + "的相关内容";
                keywords    = title + "_" + @ConfigurationManager.AppSettings["title"].ToString();
            }
            if (!string.IsNullOrEmpty(Request.QueryString["tag"]))
            {
                tag_id = (Utils.CheckInt(Request.QueryString["tag"].ToString()));
                if (tag_id != 0)
                {
                    String    sql = "select * from t_tag where id=" + tag_id;
                    DataTable dt  = artBll.SelectToDataTable(sql);
                    if (dt.Rows.Count > 0)
                    {
                        tagName = dt.Rows[0]["tag_name"].ToString();
                        if (dt.Rows[0]["tag_keyword"].ToString().Trim() != "")
                        {
                            html_title  = tagName + "_" + dt.Rows[0]["tag_keyword"].ToString() + "_好宝宝早教网";
                            description = "好宝宝早教网为您提供有关" + tagName + "_" + dt.Rows[0]["tag_keyword"].ToString() + "的相关内容";
                            keywords    = tagName + "_" + dt.Rows[0]["tag_keyword"].ToString();
                        }
                        else
                        {
                            html_title  = tagName + "_好宝宝早教网";//+ "_" + @ConfigurationManager.AppSettings["title"].ToString();
                            description = "好宝宝早教网为您提供有关" + tagName + "_" + @ConfigurationManager.AppSettings["title"].ToString() + "的相关内容";
                            keywords    = tagName + "_" + @ConfigurationManager.AppSettings["title"].ToString();
                        }
                        tishi = tagName;

                        miaoshu_pic   = dt.Rows[0]["tag_pic"].ToString();
                        miaoshu       = dt.Rows[0]["tag_miaoshu"].ToString();
                        miaoshu_title = tagName;
                        if (miaoshu.Trim() != "")
                        {
                            this.div_miaoshu.Visible = true;//显示描述div
                        }
                    }
                }
            }
            if (!string.IsNullOrEmpty(Request.QueryString["at"]) && MetarnetRegex.IsNumeric(Request.QueryString["at"]))
            {
                articleType         = Utils.CheckInt(Request.QueryString["at"].ToString());
                this.hid_type.Value = Request.QueryString["at"].ToString();

                string    sql    = "select type_name,type_keyword from t_article_type where id=" + articleType;
                DataTable dtType = artBll.SelectToDataTable(sql);
                if (dtType.Rows.Count > 0)
                {
                    articleTypeName = dtType.Rows[0]["type_name"].ToString();
                    if (dtType.Rows[0]["type_keyword"].ToString().Trim() != "")//分类关键词
                    {
                        html_title = dtType.Rows[0]["type_name"].ToString() + "_" + dtType.Rows[0]["type_keyword"].ToString() + "_好宝宝早教网";

                        description = "好宝宝早教网为您提供有关" + dtType.Rows[0]["type_name"].ToString() + "_" + dtType.Rows[0]["type_keyword"].ToString() + "_" + @ConfigurationManager.AppSettings["title"].ToString() + "的相关内容";
                        keywords    = dtType.Rows[0]["type_name"].ToString() + "," + dtType.Rows[0]["type_keyword"].ToString() + "," + @ConfigurationManager.AppSettings["title"].ToString().Replace("|", ",");
                    }
                    else
                    {
                        html_title = dtType.Rows[0]["type_name"].ToString() + "_好宝宝早教网";

                        description = "好宝宝早教网为您提供有关" + dtType.Rows[0]["type_name"].ToString() + "_" + @ConfigurationManager.AppSettings["title"].ToString() + "的相关内容";
                        keywords    = dtType.Rows[0]["type_name"].ToString() + "," + @ConfigurationManager.AppSettings["title"].ToString().Replace("|", ",");
                    }
                    tishi = dtType.Rows[0]["type_name"].ToString();
                }
            }
            if (html_title.Trim() == "")
            {
                html_title = @ConfigurationManager.AppSettings["title"].ToString();
            }

            if (!string.IsNullOrEmpty(Request.QueryString["p"]) && MetarnetRegex.IsNumeric(Request.QueryString["p"]))
            {
                int p = Convert.ToInt32(InText.SafeSql(InText.SafeStr(Request.QueryString["p"].ToString())));
                if (p > 1)
                {
                    html_title += "_第" + p + "页";
                }
            }

            if (!IsPostBack)
            {
                BindList();//绑定列表
            }
        }
Пример #14
0
        /// <summary>
        /// 验证记录仪管理选项卡输入是否正确
        /// </summary>
        private bool ValidateRecorderManageInput(out string msg)
        {
            bool ok;

            msg = string.Empty;
            ok  = MetarnetRegex.IsTime(txtComTime.Text);
            if (!ok)
            {
                txtComTime.Focus();
                txtComTime.SelectAll();
                msg = "通讯时间设置错误!";
                return(ok);
            }
            ok = MetarnetRegex.IsTime(txtRecTime.Text);
            if (!ok)
            {
                txtRecTime.Focus();
                txtRecTime.SelectAll();
                msg = "记录时间设置错误!";
                return(ok);
            }
            ok = MetarnetRegex.IsUint(txtLeakValue.Text);
            if (!ok)
            {
                txtLeakValue.Focus();
                txtLeakValue.SelectAll();
                msg = "报漏幅度值设置错误!";
                return(ok);
            }

            //if (cbConStart.Checked)
            //{
            //    ok = MetarnetRegex.IsUint(txtConId.Text);
            //    if (!ok)
            //    {
            //        txtConId.Focus();
            //        txtConId.SelectAll();
            //        msg = "控制器编号设置错误!";
            //        return ok;
            //    }
            //    ok = MetarnetRegex.IsUint(txtConPort.Text);
            //    if (!ok)
            //    {
            //        txtConPort.Focus();
            //        txtConPort.SelectAll();
            //        msg = "远传端口设置错误!";
            //        return ok;
            //    }
            //    ok = MetarnetRegex.IsIPv4(txtConAdress.Text);
            //    if (!ok)
            //    {
            //        txtConAdress.Focus();
            //        txtConAdress.SelectAll();
            //        msg = "远传地址设置错误!";
            //        return ok;
            //    }
            //}

            // 通讯时间与记录时间不能重叠
            int comTime  = Convert.ToInt32(txtComTime.Text);
            int recTime1 = Convert.ToInt32(txtRecTime.Text);
            int recTime2 = Convert.ToInt32(txtRecTime1.Text);

            if (comTime == recTime1 || comTime == recTime2 || (comTime > recTime1 && comTime < recTime2))
            {
                txtComTime.Focus();
                txtComTime.SelectAll();
                msg = "通讯时间/记录时间设置重叠!";
                return(false);
            }

            return(ok);
        }
Пример #15
0
        private bool BindList()
        {
            bool ifOk = true;

            int pageIndex   = 1;
            int pageSize    = 20;//pager.PageSize;//每页显示20条信息
            int totalRecord = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["p"]) && MetarnetRegex.IsNumeric(Request.QueryString["p"]))
            {
                pageIndex = Convert.ToInt32(InText.SafeSql(InText.SafeStr(Request.QueryString["p"].ToString())));
            }

            string where = " where 1=1";
            if (articleId != 0)
            {
                where += " and t_article.id=" + articleId;
            }
            if (title.Trim() != "")
            {
                where += " and title like '%" + title + "%'";
            }
            if (search_keyword.Trim() != "")
            {
                where += " and search_keyword like '%" + search_keyword + "%'";
            }

            if (articleType != 0)
            {
                where += " and type=" + articleType;
            }
            if (right_type != 0)
            {
                where += " and right_type=" + right_type;
            }
            if (update_date_min != "")
            {
                where += " and  DateDiff( day,  '" + update_date_min + "',update_date) >=0 ";
            }
            if (update_date_max != "")
            {
                where += " and  DateDiff( day,  '" + update_date_max + "',update_date) <=0 ";
            }
            if (tag.Trim() != "")
            {
                where += " and tag like '%" + tag + "%'";
            }
            if (html.Trim() != "")
            {
                where += " and html like '%" + html + "%'";
            }
            if (isHuandeng1 != 0)
            {
                where += " and huandeng1=1 ";
            }

            //string strSql = " Select P.ProductID,P.ProClassID,P.ProductName,P.ProFlag,P.DateTime,P.ProductImage,C.ProClassName,C.ProClassKey,C.ProClassDes FROM ProductInfo P  " +
            //                    " LEFT JOIN ProClass C ON P.ProClassID=C.ProClassID ";
            //string strShow = " ProductID,ProductName,DateTime,ProductImage,ProFlag,ProClassName,ProClassKey,ProClassDes ";
            //return ClassFile.AccessHelper.ExecutePager(PageIndex, PageSize, "ProductID", strShow, strSql, strWhere, " ProductID DESC ", out PageCount, out RecordCount);

            string strSql = " Select t_article.id as articleId,t_article.title,t_article.keyword,t_article.search_keyword,t_article.daoyu,t_article.content,t_article.type,t_article.update_date,t_article.declare_mark,t_article.pic,t_article.html,t_article.remark,t_article_type.type_name,source,t_article.tag,t_article.tag_id,t_article.huandeng1,right_type,t_article.ts_baidu "
                            + " ,row_number() over(order by t_article.id desc) as rowNumber "
                            + " FROM t_article  "
                            + " LEFT JOIN t_article_type ON t_article.type=t_article_type.id ";
            DataTable dt = artBll.ExecutePager(strSql + where, pageSize, pageIndex, ref totalRecord);

            if (dt.Rows.Count > 0)
            {
                ifOk = true;

                pager.PageSize          = pageSize;
                pager.RecordCount       = totalRecord;
                this.repList.DataSource = dt;
                this.repList.DataBind();

                this.labInfoCount.Text = totalRecord.ToString();

                if (totalRecord <= pageSize)//只有一页,隐藏分页控件
                {
                    this.divFenye.Visible = false;
                }
            }
            else
            {
                this.divFenye.Visible = false;
                ifOk = false;
            }
            return(ifOk);
        }
Пример #16
0
        public string navStr = "";// ?at=1 ?tag=1

        protected void Page_Load(object sender, EventArgs e)
        {
            CommonMethod.ValidUrl();

            if (!string.IsNullOrEmpty(Request.QueryString["title"]))
            {
                title = InText.SafeSql(InText.SafeStr(Request.QueryString["title"].ToString()));
                //this.txt_search.Value = title;
                articleTypeName        = "&gt " + "“" + title + "”的搜索结果";
                html_title             = "“" + title + "”" + "的搜索结果_好宝宝早教网";
                tishi                  = title;
                this.div_tishi.Visible = true;

                description = "好宝宝早教网为您提供有关" + title + "_" + @ConfigurationManager.AppSettings["title"].ToString() + "的相关内容";
                keywords    = title + "_" + @ConfigurationManager.AppSettings["title"].ToString();
            }
            if (!string.IsNullOrEmpty(Request.QueryString["tag"]))
            {
                tag_id = (Utils.CheckInt(Request.QueryString["tag"].ToString()));
                if (tag_id != 0)
                {
                    tagName                = this.SelectOneTagName(tag_id.ToString());
                    html_title             = tagName + "_" + @ConfigurationManager.AppSettings["title"].ToString();
                    tishi                  = tagName;
                    this.div_tishi.Visible = true;

                    description = "好宝宝早教网为您提供有关" + tagName + "_" + @ConfigurationManager.AppSettings["title"].ToString() + "的相关内容";
                    keywords    = tagName + "_" + @ConfigurationManager.AppSettings["title"].ToString();

                    navStr = "tag=" + tag_id.ToString();
                    this.div_nav.Visible = true;
                }
            }
            if (!string.IsNullOrEmpty(Request.QueryString["at"]) && MetarnetRegex.IsNumeric(Request.QueryString["at"]))
            {
                articleType = Utils.CheckInt(Request.QueryString["at"].ToString());

                string    sql    = "select type_name,type_keyword from t_article_type where id=" + articleType;
                DataTable dtType = accessBll.SelectToDataTable(sql);
                if (dtType.Rows.Count > 0)
                {
                    articleTypeName = "&gt <span style='color:#36648b'>" + dtType.Rows[0]["type_name"].ToString() + "</span>";
                    if (dtType.Rows[0]["type_keyword"].ToString().Trim() != "")//分类关键词
                    {
                        html_title = dtType.Rows[0]["type_name"].ToString() + "_" + dtType.Rows[0]["type_keyword"].ToString() + "_好宝宝早教网";

                        description = "好宝宝早教网为您提供有关" + dtType.Rows[0]["type_name"].ToString() + "_" + dtType.Rows[0]["type_keyword"].ToString() + "_" + @ConfigurationManager.AppSettings["title"].ToString() + "的相关内容";
                        keywords    = dtType.Rows[0]["type_name"].ToString() + "," + dtType.Rows[0]["type_keyword"].ToString() + "," + @ConfigurationManager.AppSettings["title"].ToString().Replace("|", ",");
                    }
                    else
                    {
                        html_title = dtType.Rows[0]["type_name"].ToString() + "_好宝宝早教网";

                        description = "好宝宝早教网为您提供有关" + dtType.Rows[0]["type_name"].ToString() + "_" + @ConfigurationManager.AppSettings["title"].ToString() + "的相关内容";
                        keywords    = dtType.Rows[0]["type_name"].ToString() + "," + @ConfigurationManager.AppSettings["title"].ToString().Replace("|", ",");
                    }
                    tishi = dtType.Rows[0]["type_name"].ToString();

                    navStr = "at=" + articleType.ToString();
                    this.div_nav.Visible = true;
                }
            }

            if (html_title.Trim() == "")
            {
                html_title = @ConfigurationManager.AppSettings["title"].ToString();
            }

            if (tishi.Trim() == "")
            {
                this.div_tishi.Visible = false;
            }

            if (!IsPostBack)
            {
                BindList();//绑定列表

                //GetTypeList();//绑定文章分类
                //BindHotList();//绑定热门文章
            }
        }
Пример #17
0
        private bool BindList()
        {
            bool ifOk = true;

            int pageIndex   = 1;
            int pageSize    = 20;//pager.PageSize;//每页显示10条信息
            int totalRecord = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["p"]) && MetarnetRegex.IsNumeric(Request.QueryString["p"]))
            {
                pageIndex = Convert.ToInt32(InText.SafeSql(InText.SafeStr(Request.QueryString["p"].ToString())));
            }

            string where = " where 1=1";
            if (articleId != 0)
            {
                where += " and articleId=" + articleId;
            }
            if (title.Trim() != "")
            {
                where += " and title like '%" + title + "%'";
            }
            if (tag_id != 0)
            {
                where += " and tag_id like '%," + tag_id + ",%'";
            }
            if (articleType != 0)
            {
                where += " and type=" + articleType;
            }

            if (where == " where 1=1")
            {
                where += " and daoyu<>'no' ";
            }
            //string strSql = " Select P.ProductID,P.ProClassID,P.ProductName,P.ProFlag,P.DateTime,P.ProductImage,C.ProClassName,C.ProClassKey,C.ProClassDes FROM ProductInfo P  " +
            //                    " LEFT JOIN ProClass C ON P.ProClassID=C.ProClassID ";
            //string strShow = " ProductID,ProductName,DateTime,ProductImage,ProFlag,ProClassName,ProClassKey,ProClassDes ";
            //return ClassFile.AccessHelper.ExecutePager(PageIndex, PageSize, "ProductID", strShow, strSql, strWhere, " ProductID DESC ", out PageCount, out RecordCount);

            string strSql = " Select t_article.id as articleId,t_article.title,t_article.keyword,t_article.daoyu,t_article.content,t_article.type,t_article.update_date,t_article.declare_mark,t_article.pic,t_article.html,t_article.remark,t_article_type.type_name,tag,tag_id FROM t_article  " +
                            " LEFT JOIN t_article_type ON t_article.type=t_article_type.id ";
            string    strShow   = " articleId,title,keyword,daoyu,content,type,update_date,declare_mark,pic,remark,type_name,html,tag,tag_id ";//要显示的字段
            int       PageCount = 0;
            DataTable dt        = accessBll.ExecutePager(pageIndex, pageSize, "articleId", strShow, strSql, where, " update_date DESC ", out PageCount, out totalRecord);

            string sqlCount = "select count(*) from t_article left join t_article_type on t_article.type=t_article_type.id " + where;

            //totalRecord = accessBll.MaxCount(sqlCount);
            if (dt.Rows.Count > 0)
            {
                ifOk = true;

                pager.PageSize           = pageSize;
                pager.RecordCount        = totalRecord;
                this.repList1.DataSource = dt;
                this.repList1.DataBind();

                //this.labInfoCount.Text = totalRecord.ToString();

                if (totalRecord <= pageSize)//只有一页,隐藏分页控件
                {
                    this.divFenye.Visible = false;
                }

                this.div_news.Visible = true;
            }
            else
            {
                this.divFenye.Visible = false;
                ifOk = false;

                //绑定最新发布的前N条文章
                sql = "Select top 30 t_article.id as articleId,t_article.title,t_article.keyword,t_article.daoyu,t_article.content,t_article.type,t_article.update_date,t_article.declare_mark,t_article.pic,t_article.html,t_article.remark,t_article_type.type_name,source,tag,tag_id FROM t_article  " +
                      " LEFT JOIN t_article_type ON t_article.type=t_article_type.id  ";

                sql += " where daoyu<>'no' ";

                sql += " order by update_date desc ";
                dt   = accessBll.SelectToDataTable(sql);
                if (dt.Rows.Count > 0)
                {
                    this.repList2.DataSource = dt;
                    this.repList2.DataBind();
                }
                this.div_nonews1.Visible = true;
                this.div_nonews2.Visible = true;
            }
            return(ifOk);
        }
Пример #18
0
        private bool BindList()
        {
            bool ifOk = true;

            int pageIndex   = 1;
            int pageSize    = 30;//pager.PageSize;//每页显示10条信息
            int totalRecord = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["p"]) && MetarnetRegex.IsNumeric(Request.QueryString["p"]))
            {
                pageIndex = Convert.ToInt32(InText.SafeSql(InText.SafeStr(Request.QueryString["p"].ToString())));
            }

            string where = " where 1=1";
            if (articleId != 0)
            {
                where += " and articleId=" + articleId;
            }
            if (title.Trim() != "")
            {
                where += " and (title like '%" + title + "%' or keyword like '%" + title + "%' or tag_name like '%" + title + "%' or search_keyword like '%" + title + "%')";
            }
            if (tag_id != 0)
            {
                where += " and tag_id like '%," + tag_id + ",%'";
            }
            if (articleType != 0)
            {
                where += " and type=" + articleType;
            }

            if (where == " where 1=1")
            {
                //where += " and daoyu<>'no' ";
            }

            string strSql = " Select t_article.id as articleId,t_article.title,t_article.keyword,t_article.daoyu,t_article.content,t_article.type,t_article.update_date,t_article.declare_mark,t_article.pic,t_article.html,t_article.remark,t_article_type.type_name,tag,tag_id,tag_name "
                            + " ,row_number() over(order by t_article.id desc) as rowNumber "
                            + " FROM t_article  "
                            + "  LEFT JOIN t_article_type ON t_article.type=t_article_type.id "
                            + " LEFT JOIN t_tag ON replace(t_article.tag_id,',','')=t_tag.id ";
            DataTable dt = artBll.ExecutePager(strSql + where, pageSize, pageIndex, ref totalRecord);

            //string strShow = " articleId,title,keyword,daoyu,content,type,update_date,declare_mark,pic,remark,type_name,html,tag,tag_id ";//要显示的字段
            //int PageCount = 0;
            //DataTable dt = artBll.ExecutePager(strSql, pageSize, pageIndex, ref totalRecord);

            //string sqlCount = "select count(*) from t_article left join t_article_type on t_article.type=t_article_type.id " + where;
            //totalRecord = accessBll.MaxCount(sqlCount);
            if (dt.Rows.Count > 0)
            {
                ifOk = true;

                pager.PageSize           = pageSize;
                pager.RecordCount        = totalRecord;
                this.repList1.DataSource = dt;
                this.repList1.DataBind();

                //this.labInfoCount.Text = totalRecord.ToString();

                if (totalRecord <= pageSize)//只有一页,隐藏分页控件
                {
                    this.divFenye.Visible = false;
                }

                //this.div_news.Visible = true;
            }
            else
            {
                this.divFenye.Visible = false;
                ifOk = false;

                //绑定最新发布的前N条文章
                sql = "Select top 20 t_article.id as articleId,t_article.title,t_article.keyword,t_article.daoyu,t_article.content,t_article.type,t_article.update_date,t_article.declare_mark,t_article.pic,t_article.html,t_article.remark,t_article_type.type_name,source,tag,tag_id FROM t_article  " +
                      " LEFT JOIN t_article_type ON t_article.type=t_article_type.id  ";

                sql += " where daoyu<>'no' ";

                sql += " order by update_date desc ";
                dt   = artBll.SelectToDataTable(sql);
                if (dt.Rows.Count > 0)
                {
                    this.repList2.DataSource = dt;
                    this.repList2.DataBind();
                }
                this.div_nonews1.Visible = true;
                this.div_nonews2.Visible = true;
            }
            return(ifOk);
        }