前台网站页面

 

 

//前台页面

 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebFormTest.aspx.cs" Inherits="WebApplicationUI.TestPage.WebFormTest" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
  

 

<style type="text/css">
        .noticeTitle
        {
            color: #FFFFFF;
            font-size: 14px;
            font-family: 黑体;
            height: 20px;
        }
        .noticeContent
        {
            font-family: 黑体;
            font-size: 12px;
            color: #60625D;
        }
        .tableContent
        {
            font-family: 宋体;
            font-size: 14px;
            color: #60625D;
            text-align: center;
        }
        fieldset
        {
            font-size: 12px;
            line-height: 140%;
            border: shadow(direction=135,color=#92BA3F,strength=1);
            color: #585E5C;
            width: 100%;
            padding: 5px;
        }
        legend
        {
            padding: 4px;
            color: #92BA3F;
            font-size: 18px;
            font-family: 方正舒体;
        }
        .style1
        {
            width: 80px;
        }
           .menuBtn{  
                        FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#FFFFFF, EndColorStr=#B7C985);       
                        border:1pt solid #B7C985;
                        border-collapse:collapse;
                        height:25px;
                        width:80px;
                        text-align:center;
            }
            .input
            {
              width:130px
            }
        .style2
        {
            width: 80px;
            height: 37px;
        }
        .style3
        {
            width: 130px;
            height: 37px;
        }
       .btn_2k3 {
                    font-family: "tahoma", "宋体";
                    color: #FFFFFF;
                    border: 0px solid #93bee2;
                    cursor: hand;
                    font-style: normal;
                    width:60px;
                    margin-bottom: 0px;
       }
    </style>
    <script type="text/javascript">
        function FindPass() {
            window.showModalDialog("Pages/FindPassword.aspx", "找回密码", "dialogWidth=450px;dialogHeight=345px;center=yes;resizable=no;help=no;status:no;scroll=no");
        }
    </script>

 

 

 


    </head>
<body>
    <form id="form1" runat="server">
    <div>

 

 

 

    <table cellspacing="0" cellpadding="0" style="width: 1100px;" border="0">
        <tr>
            <td colspan="5" style="height: 104px;"></td>
        </tr>
        <tr>
            <td colspan="5" style="height: 424px; background-image: url(/HealthWebSite/images/healthlife.png);" valign="top">             
                <table style="width:100%">
                    <tr><td style="width:70%"></td>
                        <td valign="top">
                            <div id="login" runat="server">
                                <table style="width:262px; margin-top:0px; border-color:#B7C985; border:1; border-style:solid;"  valign="top">
                                    <tr>
                                        <td class="style2" align="center" >用户名</td>
                                        <td class="style3" colspan = "2"><asp:TextBox ID="txtUserName" runat="server" CssClass="input" ></asp:TextBox></td>
                                    </tr>
                                    <tr>
                                        <td class="style1" align="center">密码</td>
                                        <td style="width:100px;" colspan = "2"><asp:TextBox ID="txtPwd" runat="server" TextMode="Password" CssClass="input"></asp:TextBox></td>   
                                    </tr>
                                     <tr>
                                        <td class="style1"><asp:Button ID="btnque" CssClass="menuBtn" runat="server" Text="登录" οnclick="btnque_Click"  /></td>
                                        <td align = "center"><a href="Pages/Infozhuce1.aspx" class = "menuBtn"  target="_blank">用户激活</a></td>
                                        <td align = "center"><a href = "#"onclick = "FindPass()" style = "font-size:9" onmouseover = "this.style.color = 'blue';this.style.text-decoration='underline';">忘记密码?</a></td>  
                                     </tr>
                                </table>
                            </div>
                        </td>
                    </tr>
              </table>
          </td>
       </tr>
        <tr>
            <td style="height: 30px;">
            </td>
            <td>
            </td>
            <td>
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td  colspan="5">
                <table id = "tb_news" runat = "server" style="width:100%">
                    <tr>
                        <td style="width: 315px;" valign="top">
                         <table style="background-image: url(/HealthWebSite/images/notice.gif); background-repeat: no-repeat;height: 20px;width: 100%" cellpadding=0 cellspacing=0>
                                        <tr>
                                        <td class="noticeTitle">
                                         &nbsp; 健康活动
                                        </td>
                                        <td class="noticeTitle" style="text-align: center;">
                                          <asp:LinkButton ID="lbtnHealthActivity" runat="server"  CssClass="btn_2k3"  Text="更多"
                                                οnclick="lbtnMoreInfo_Click"   />
                                         </td>
                                        </tr>
                        </table>
                            <asp:DataList ID="listHealthActivity" Width="100%" runat="server"
                                onitemdatabound="listHealthActivity_ItemDataBound">
                                <HeaderTemplate>
                                    <table style="width: 100%">
                                </HeaderTemplate>
                               
                               
                    <ItemTemplate>
                        <tr>
                            <td style="font-size: 10px; color: #B7C985; text-align: right; width: 15px; height: 29px;">
                                ●
                            </td>
                            <td style="font-family: 黑体; font-size: 14px;cursor: pointer; color: #808080; border-bottom-style: solid; border-bottom-width: 0.5pt;
                                border-bottom-color: #E2E9D3;">
                               
                                <a href="/pages/ActitiesShower.aspx?ActivityId=<%# Eval("id") %>" target="_blank">
                                    <%# Eval("TopicOfNotice") %>
                                    <img src ="Images/home_new.gif" id = "img01" runat = "server" alt = "最新消息" style = " border:0px;" />
                                </a>
                               
                            </td>
                        </tr>
                    </ItemTemplate>
                   
                   
                    <FooterTemplate>
                        <tr>
                            <td style="font-size: 10px; color: #B7C985; text-align: right; width: 15px; height: 29px;">
                                ●
                            </td>
                            <td οnclick="recover();" οnmοuseοver="style.color='#008000';" οnmοuseοut="style.color='#808080'"
                                style="font-family: 黑体; font-size: 14px; cursor: pointer; color: #808080; border-bottom-style: solid;
                                border-bottom-width: 0.5pt; border-bottom-color: #E2E9D3; font-weight: bold;">
                                返 &nbsp;回
                            </td>
                        </tr>
                        </table>
                    </FooterTemplate>
                </asp:DataList>
               </td>
                        <td>
                        </td>
                        <td style="width: 315px;" valign="top">
                       
                       
                              <table style="width: 100%;background-image: url(/HealthWebSite/images/notice.gif); background-repeat: no-repeat;
                                                height: 20px;">
                                        <tr >
                                         <td class="noticeTitle">
                                          &nbsp; 健康你我他
                                          </td>
                                          <td class="noticeTitle" style="text-align: center;">
                                                     <asp:LinkButton ID="lbtnYouAndMe" runat="server"  CssClass="btn_2k3"  Text="更多" οnclick="lbtnMoreInfo_Click"    />
                                          </td>
                                        </tr>
                              </table>
                             
                             
                             
                           <asp:DataList ID="listHealthYouAndMe" Width="100%" runat="server"
                                  onitemdatabound="listHealthYouAndMe_ItemDataBound" >
                                <HeaderTemplate>
                                     <table style="width: 100%">
                                </HeaderTemplate>
                    <ItemTemplate>
                        <tr>
                            <td style="font-size: 10px; color: #B7C985; text-align: right; width: 15px; height: 29px;">
                                ●
                            </td>
                            <td style="font-family: 黑体; font-size: 14px;cursor: pointer; color: #808080; border-bottom-style: solid; border-bottom-width: 0.5pt;
                                border-bottom-color: #E2E9D3;">
                                <a href="/pages/ActitiesShower.aspx?ActivityId=<%# Eval("id") %>" target="_blank"><%# Eval("TopicOfNotice") %><img src ="Images/home_new_3.gif" id = "img02" runat = "server" alt = "最新消息" style = " border:0px;" /></a>
                               
                            </td>
                            <td></td>
                        </tr>
                    </ItemTemplate>
                    <FooterTemplate>
                        <tr>
                            <td style="font-size: 10px; color: #B7C985; text-align: right; width: 15px; height: 29px;">
                                ●
                            </td>
                            <td οnclick="recover();" οnmοuseοver="style.color='#008000';" οnmοuseοut="style.color='#808080'"
                                style="font-family: 黑体; font-size: 14px; cursor: pointer; color: #808080; border-bottom-style: solid;
                                border-bottom-width: 0.5pt; border-bottom-color: #E2E9D3; font-weight: bold;">
                                返 &nbsp;回
                            </td>
                        </tr>
                        </table>
                    </FooterTemplate>
                </asp:DataList>
                 </td>
                        <td>
                        </td>
                        <td style="width: 315px;" valign="top">
                       
                        <table style="width: 100%;background-image: url(/HealthWebSite/images/notice.gif); background-repeat: no-repeat;
                                                height: 20px;">
                                        <tr >
                                         <td class="noticeTitle">
                                          &nbsp; 健康服务
                                          </td>
                                          <td class="noticeTitle" style="text-align: center;">
                                              <asp:LinkButton ID="lbtnHealthService" runat="server"  CssClass="btn_2k3"  Text="更多" οnclick="lbtnMoreInfo_Click"   />
                                          </td>
                                        </tr>
                              </table>
                        <asp:DataList ID="listHealthService" Width="100%" runat="server"
                                onitemdatabound="listHealthService_ItemDataBound">
                                <HeaderTemplate>
                                    <table style="width: 100%">
                                </HeaderTemplate>
                    <ItemTemplate>
                        <tr>
                            <td style="font-size: 10px; color: #B7C985; text-align: right; width: 15px; height: 29px;">
                                ●
                            </td>
                            <td style="font-family: 黑体; font-size: 14px;cursor: pointer; color: #808080; border-bottom-style: solid; border-bottom-width: 0.5pt;
                                border-bottom-color: #E2E9D3;">
                                <a href="/pages/ActitiesShower.aspx?ActivityId=<%# Eval("id") %>" target="_blank"><%# Eval("TopicOfNotice") %><img src ="Images/home_new_1.gif" id = "img03" runat = "server" alt = "最新消息" style = " border:0px;" /></a>
                               
                            </td>
                        </tr>
                    </ItemTemplate>
                    <FooterTemplate>
                        <tr>
                            <td style="font-size: 10px; color: #B7C985; text-align: right; width: 15px; height: 29px;">
                                ●
                            </td>
                            <td οnclick="recover();" οnmοuseοver="style.color='#008000';" οnmοuseοut="style.color='#808080'"
                                style="font-family: 黑体; font-size: 14px; cursor: pointer; color: #808080; border-bottom-style: solid;
                                border-bottom-width: 0.5pt; border-bottom-color: #E2E9D3; font-weight: bold;">
                                返 &nbsp;回
                            </td>
                        </tr>
                        </table>
                    </FooterTemplate>
                </asp:DataList>
         
                        </td>
                    </tr>
                </table>
                <table id = "tb_more_news" visible = "false" runat = "server" style = "width:100%">
                    <tr style = "height:20;background-image:url(/HealthWebSite/images/center.png)">
                        <td style = "width:100%">
                            <table style = "width:100%">
                                <tr>
                                    <td style = "color:White; font-size:14"><span id = "spanTitle" runat = "server"></span></td>
                                    <td style = "background-image:url(/HealthWebSite/images/center.png); background-repeat:repeat"></td>
                                    <td align = "right"><a href = "#" onclick = "javascript:history.back()" style = "text-decoration:none;color:White" onmouseover = "style.color= 'red'" onmouseout = "style.color= 'White'">&lt;&lt;返回</a></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:DataList ID = "listMoreInfo" runat = "server" RepeatColumns = "3"
                                RepeatDirection ="Horizontal" RepeatLayout ="Table" Width = "100%">
                                <ItemTemplate>
                                    <table style = "border-bottom-style: solid;border-bottom-width: 0.5pt;border-bottom-color: #E2E9D3">
                                        <tr>
                                            <td style="font-size: 10px; color: #B7C985; text-align: right; width: 15px; height: 29px;">●</td>
                                            <td style = "font-size:12px"><a href="/pages/ActitiesShower.aspx?ActivityId=<%# Eval("id") %>" target="_blank"><%# Eval("TopicOfNotice") %></a></td>
                                        </tr>
                                    </table>       
                                </ItemTemplate>
                            </asp:DataList>
                            <table style = "font-size:12px">
                                <tr>
                                    <td colspan = "5"><br /></td>
                                </tr>
                                <tr>
                                   <td style = "color:Green">共<font color = "red"><%= ps.PageCount %></font>页<font color = "red" ><%= ps.DataSourceCount %></font>条数据</td>
                                   <td style = "color:Green">当前第<font color= "red"><%= ps.CurrentPageIndex + 1 %></font>页</td>
                                   <td><asp:LinkButton ID = "lnkPrevious" runat = "server" OnClick = "lnk_Click" Font-Size = "10">【上一页】</asp:LinkButton></td>
                                   <td><asp:LinkButton ID = "lnkNext" runat = "server" OnClick = "lnk_Click" Font-Size = "10">【下一页】</asp:LinkButton></td>
                                   <td><asp:LinkButton ID = "lnkEnd" runat = "server" OnClick = "lnk_Click" Font-Size = "10">【末页】</asp:LinkButton></td>
                                </tr>
                                <tr><asp:HiddenField ID = "hidMoreNews" runat = "server" Value = "1" /></tr>
                           </table>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
      
 
       
    </table>
    <script type="text/javascript">
        document.getElementById("toolBar").style.display = "none";
    </script>

     
    </div>
    </form>
</body>
</html>

 

 

 

//后台页面(多个linkbutton公用一个事件)

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Common;
using Oledb;
using Platform;

namespace HealthWebSite
{
    public partial class Index : System.Web.UI.Page
    {
        int count = 0;
        int count_01 = 0;
        int count_02 = 0;
        Oledb.ITemplate temp = null;
        public PagedDataSource ps = null;
        private const string SQL_ACTIVITY = "select top 5 id,TopicOfNotice from  Web_Notices where TypeOfNotice='2' order by CreatingDate desc";
        private const string SQL_YOU_AND_ME = "select top 5 id,TopicOfNotice from  Web_Notices where TypeOfNotice='5' order by CreatingDate desc";
        private const string SQL_SERVICE = "select top 5 id,TopicOfNotice from  Web_Notices where TypeOfNotice='7' order by CreatingDate desc";
        protected void Page_Load(object sender, EventArgs e)
        {
            temp = DatabaseAccessHandler.GetTemplate(ConnectionName.ClientA);
            if (Session["UserInfo"] != null)
            {
                login.Visible = false;
                Master.getGreetingText();
            }
            else
            {
                Authenticate();
            }
            if (!Page.IsPostBack)
            {
                if (Request.Cookies["userinfo"]!=null)
                {
                    txtUserName.Text = Request.Cookies["userinfo"].Value;
                }
                BindNoticesInfo();
            }
        }
        private void BindNoticesInfo()
        {
            listHealthActivity.DataSource = temp.Find(SQL_ACTIVITY);
            listHealthActivity.DataBind();
            listHealthYouAndMe.DataSource = temp.Find(SQL_YOU_AND_ME);
            listHealthYouAndMe.DataBind();
            listHealthService.DataSource = temp.Find(SQL_SERVICE);
            listHealthService.DataBind();
        }
        private int[] getDataWithin15Days()
        {
            string sql_01 = "select count(*) from Web_Notices where  DATEDIFF(DD,CreatingDate,GETDATE()) < 15 and typeofnotice = '2'";
            string sql_02 = "select count(*) from Web_Notices where  DATEDIFF(DD,CreatingDate,GETDATE()) < 15 and typeofnotice = '5'";
            string sql_03 = "select count(*) from Web_Notices where  DATEDIFF(DD,CreatingDate,GETDATE()) < 15 and typeofnotice = '7'";
            int[] array_count = new int[3];
            DataSet ds_01 = temp.Find(sql_01);
            DataSet ds_02 = temp.Find(sql_02);
            DataSet ds_03 = temp.Find(sql_03);
            if (ds_01.Tables[0].Rows.Count > 0)
            {
                array_count[0] = int.Parse(ds_01.Tables[0].Rows[0][0].ToString());
            }
            else
            {
                array_count[0] = 0;
            }
            if (ds_02.Tables[0].Rows.Count > 0)
            {
                array_count[1] = int.Parse(ds_02.Tables[0].Rows[0][0].ToString());
            }
            else
            {
                array_count[1] = 0;
            }
            if (ds_03.Tables[0].Rows.Count > 0)
            {
                array_count[2] = int.Parse(ds_03.Tables[0].Rows[0][0].ToString());
            }
            else
            {
                array_count[2] = 0;
            }
            return array_count;

        }
        /// <summary>
        /// 根据传过来的参数验证
        /// </summary>
        public void Authenticate()
        {
            string bz = Convert.ToString(Request.QueryString["bz"]);
            string str_id_no = Convert.ToString(Request.QueryString["sfz"]);
            if ((bz != null) || (str_id_no != null))
            {
                txtUserName.Text = str_id_no.Trim();
                string sql_user_check = string.Format("select LOGIN_PWD FROM WEB_ADDITIONAL_PINFO WHERE IDNumber='{0}'", txtUserName.Text);
                DataSet ds = temp.Find(sql_user_check);
                if (Convert.ToInt32(bz) == 0)
                {
                    if (ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0)
                    {
                        txtPwd.Text = ds.Tables[0].Rows[0]["LOGIN_PWD"].ToString();
                    }
                    else
                    {
                        ClientScript.RegisterClientScriptBlock(GetType(), "OnLoad", "alert('用户名不存在');", true);
                    }
                    btnque_Click(null, null);
                }
                else
                {
                    if (ds.Tables.Count == 0 && ds.Tables[0].Rows.Count == 0)
                    {
                        ClientScript.RegisterClientScriptBlock(GetType(), "OnLoad", "alert('身份证不存在');", true);
                    }
                    txtUserName.Text = str_id_no.ToString().Trim();
                }
            }
        }

        protected void btnque_Click(object sender, EventArgs e)
        {
            try
            {
                string ID_NO = txtUserName.Text.ToString().Trim();
                string pwd = txtPwd.Text;
                if ("".Equals(ID_NO))
                {
                    ClientScript.RegisterClientScriptBlock(GetType(), "OnLoad", "alert('用户名不能为空');", true);
                }
                else if ("".Equals(pwd))
                {
                    ClientScript.RegisterClientScriptBlock(GetType(), "OnLoad", "alert('密码不能为空');", true);
                }
                else
                {
                    //string sql = "SELECT BasicInfoID,PatientType,mechanismid,NAME,(select org_name from STATIC_INSTITUTIONS where ID =a.MECHANISMID) OrgName FROM WEB_ADDITIONAL_PINFO a WHERE IDNumber=@ID_NUM AND LOGIN_PWD=@LOGIN_PWD";

                    string sql = "SELECT BasicInfoID, IDNumber, PatientType,mechanismid,NAME,(select org_name from STATIC_INSTITUTIONS where ID =a.MECHANISMID) OrgName FROM WEB_ADDITIONAL_PINFO a WHERE IDNumber=@ID_NUM AND LOGIN_PWD=@LOGIN_PWD";


                    DataSet dst = temp.Find(sql, new Oledb.Parameter[] { new Oledb.Parameter("@ID_NUM", ID_NO), new Oledb.Parameter("@LOGIN_PWD", pwd) });

                    UserInfo info = new UserInfo();//这里实例化一个UserInfo类,得到一个UserInfo对象(实例)

                    if (dst.Tables.Count != 0 && dst.Tables[0].Rows.Count != 0) //通过验证
                    {
                        //根据用户审核状态来判别是否可以登陆
                        int Typeid = Convert.ToInt32(dst.Tables[0].Rows[0]["PatientType"]);
                        if (Typeid == 0)
                        {

                            //这里就对上面得到的UserInfo对象进行武装

                            info.Fullname = dst.Tables[0].Rows[0]["NAME"].ToString();
                            info.IdNumber = ID_NO;
                            info.Userid = dst.Tables[0].Rows[0]["BasicInfoID"].ToString().ToUpper();
                            info.Password = pwd;
                            info.OrgCode = dst.Tables[0].Rows[0]["mechanismid"].ToString().ToUpper();
                            info.OrgName = dst.Tables[0].Rows[0]["OrgName"].ToString().ToUpper();

                            //得到当前登录用户的身份证号
                            info.IdNumber = dst.Tables[0].Rows[0]["IDNumber"].ToString().ToUpper();

 

                            Session["UserInfo"] = info;//把得到的UserInfo对象放到Session里面

                            Response.Cookies["userinfo"].Value = ID_NO;//把当前登录者的用户名放在Cookie里面
                            Response.Cookies["userinfo"].Expires = DateTime.Now.AddDays(7);//设置Cooki的有效时间是7天

                            login.Visible = false;
                            Master.getGreetingText();
                        }
                        else
                        {
                            ClientScript.RegisterClientScriptBlock(GetType(), "OnLoad", "alert('还未通过审核登陆失败');", true);
                        }
                    }
                    else
                    {
                        string sql1 = "select BasicInfoID,PatientType,mechanismid,NAME from WEB_ADDITIONAL_PINFO   where  nickname=@nickname and  LOGIN_PWD=@LOGIN_PWD";
                        DataSet set = temp.Find(sql1, new Oledb.Parameter[] { new Oledb.Parameter("@ID_NUM", ID_NO), new Oledb.Parameter("@LOGIN_PWD", pwd) });
                        if (set.Tables.Count != 0 && set.Tables[0].Rows.Count != 0) //通过验证
                        {
                            //根据用户审核状态来判别是否可以登陆
                            int Typeid = Convert.ToInt32(set.Tables[0].Rows[0]["PatientType"]);
                            if (Typeid == 0)
                            {
                                info.Fullname = set.Tables[0].Rows[0]["NAME"].ToString();
                                info.IdNumber = ID_NO;
                                info.Userid = set.Tables[0].Rows[0]["BasicInfoID"].ToString().ToUpper();
                                info.Password = pwd;
                                info.OrgCode = dst.Tables[0].Rows[0]["mechanismid"].ToString().ToUpper();
                                Session["UserInfo"] = info;
                                login.Visible = false;
                                Master.getGreetingText();
                            }
                            else
                            {
                                ClientScript.RegisterClientScriptBlock(GetType(), "OnLoad", "alert('还未通过审核登陆失败');", true);
                            }
                        }
                        else
                        {
                            ClientScript.RegisterClientScriptBlock(GetType(), "OnLoad", "alert('用户名或密码输入有误');", true);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ex.ToString();

            }
        }
        protected void listHealthActivity_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) && (e.Item.ItemType != ListItemType.Header))
            {
                count++;
                if (count <= getDataWithin15Days()[0])
                {
                    (e.Item.FindControl("img01") as HtmlControl).Visible = true;
                }
                else
                    (e.Item.FindControl("img01") as HtmlControl).Visible = false;
            }
        }
        protected void listHealthYouAndMe_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) && (e.Item.ItemType != ListItemType.Header))
            {
                count_02++;
                if (count_02 <= getDataWithin15Days()[1])
                {
                    (e.Item.FindControl("img02") as HtmlControl).Visible = true;
                }
                else
                    (e.Item.FindControl("img02") as HtmlControl).Visible = false;
            }
        }


        protected void listHealthService_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) && (e.Item.ItemType != ListItemType.Header))
            {
                count_01++;
                if (count_01 <= getDataWithin15Days()[2])
                {
                    (e.Item.FindControl("img03") as HtmlControl).Visible = true;
                }
                else
                    (e.Item.FindControl("img03") as HtmlControl).Visible = false;
            }
        }

 

        //多个linkbutton按钮共同绑定一个事件
        protected void lbtnMoreInfo_Click(object sender, EventArgs e)
        {
            LinkButton objButton = sender as LinkButton;//拿到触发的控件源,前台是多个linkbutton控件共同使用一个响应事件

            if (objButton.ID == "lbtnHealthActivity")
            {
                getPagedDataSource(objButton.ID);//对DataList的数据绑定
                tb_news.Visible = false;
                tb_more_news.Visible = true;
                spanTitle.InnerText = "健康活动";
            }
            else if (objButton.ID == "lbtnYouAndMe")
            {
                getPagedDataSource(objButton.ID);//对DataList的数据绑定
                tb_news.Visible = false;
                tb_more_news.Visible = true;
                spanTitle.InnerText = "健康你我他";
            }
            else
            {
                getPagedDataSource(objButton.ID);//对DataList的数据绑定
                tb_news.Visible = false;
                tb_more_news.Visible = true;
                spanTitle.InnerText = "健康服务";
            }
            Session["Notice"] = objButton.ID;
        }

 

        /// <summary>
        /// 根据选中的更多linkbutton按钮来确定DataList绑定的数据源
        /// </summary>
        /// <param name="objID"></param>
        private void getPagedDataSource(string objID)
        {
            int currentPage = int.Parse(hidMoreNews.Value) - 1;
            ps = new PagedDataSource();
            if (objID == "lbtnHealthActivity")
            {
                ps.DataSource = temp.Find("select id,TopicOfNotice from  Web_Notices where TypeOfNotice='2' order by CreatingDate desc").Tables[0].DefaultView;
            }
            else if (objID == "lbtnYouAndMe")
            {
                ps.DataSource = temp.Find("select id,TopicOfNotice from  Web_Notices where TypeOfNotice='5' order by CreatingDate desc").Tables[0].DefaultView;
            }
            else
            {
                ps.DataSource = temp.Find("select id,TopicOfNotice from  Web_Notices where TypeOfNotice='7' order by CreatingDate desc").Tables[0].DefaultView;
            }
            ps.AllowPaging = true;
            ps.PageSize = 30;
            ps.CurrentPageIndex = currentPage;
            Session["endPage"] = ps.PageCount;

            listMoreInfo.DataSource = ps;
            lnkPrevious.Enabled = true;
            lnkNext.Enabled = true;
            lnkEnd.Enabled = true;

            if (ps.DataSourceCount < ps.PageSize)
            {
                lnkPrevious.Enabled = false;
                lnkNext.Enabled = false;
                lnkEnd.Enabled = false;
            }
            else
            {
                if (ps.CurrentPageIndex == 0)
                {
                    lnkPrevious.Enabled = false;
                }
                if (ps.CurrentPageIndex == ps.PageCount - 1)
                {
                    lnkEnd.Enabled = false;
                    lnkNext.Enabled = false;
                }
            }
            try
            {
                listMoreInfo.DataBind();
            }
            catch
            { }
          
        }
        protected void lnk_Click(object sender, EventArgs e)
        {
            LinkButton objButton = sender as LinkButton;
            if (objButton.ID == "lnkPrevious")
            {
                hidMoreNews.Value = (int.Parse(hidMoreNews.Value) - 1).ToString();
                getPagedDataSource(Session["Notice"].ToString());
            }
            else if (objButton.ID == "lnkNext")
            {
                hidMoreNews.Value = (int.Parse(hidMoreNews.Value) + 1).ToString();
                getPagedDataSource(Session["Notice"].ToString());
            }
            else
            {
                hidMoreNews.Value = Session["endPage"].ToString();
                getPagedDataSource(Session["Notice"].ToString());
            }
        }
    }
}

 

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
机器学习是一种人工智能(AI)的子领域,致力于研究如何利用数据和算法让计算机系统具备学习能力,从而能够自动地完成特定任务或者改进自身性能。机器学习的核心思想是让计算机系统通过学习数据中的模式和规律来实现目标,而不需要显式地编程。 机器学习应用非常广泛,包括但不限于以下领域: 图像识别和计算机视觉: 机器学习在图像识别、目标检测、人脸识别、图像分割等方面有着广泛的应用。例如,通过深度学习技术,可以训练神经网络来识别图像中的对象、人脸或者场景,用于智能监控、自动驾驶、医学影像分析等领域。 自然语言处理: 机器学习在自然语言处理领域有着重要的应用,包括文本分类、情感分析、机器翻译、语音识别等。例如,通过深度学习模型,可以训练神经网络来理解和生成自然语言,用于智能客服、智能助手、机器翻译等场景。 推荐系统: 推荐系统利用机器学习算法分析用户的行为和偏好,为用户推荐个性化的产品或服务。例如,电商网站可以利用机器学习算法分析用户的购买历史和浏览行为,向用户推荐感兴趣的商品。 预测和预测分析: 机器学习可以用于预测未来事件的发生概率或者趋势。例如,金融领域可以利用机器学习算法进行股票价格预测、信用评分、欺诈检测等。 医疗诊断和生物信息学: 机器学习在医疗诊断、药物研发、基因组学等领域有着重要的应用。例如,可以利用机器学习算法分析医学影像数据进行疾病诊断,或者利用机器学习算法分析基因数据进行疾病风险预测。 智能交通和物联网: 机器学习可以应用于智能交通系统、智能城市管理和物联网等领域。例如,可以利用机器学习算法分析交通数据优化交通流量,或者利用机器学习算法分析传感器数据监测设备状态。 以上仅是机器学习应用的一部分,随着机器学习技术的不断发展和应用场景的不断拓展,机器学习在各个领域都有着重要的应用价值,并且正在改变我们的生活和工作方式。
机器学习是一种人工智能(AI)的子领域,致力于研究如何利用数据和算法让计算机系统具备学习能力,从而能够自动地完成特定任务或者改进自身性能。机器学习的核心思想是让计算机系统通过学习数据中的模式和规律来实现目标,而不需要显式地编程。 机器学习应用非常广泛,包括但不限于以下领域: 图像识别和计算机视觉: 机器学习在图像识别、目标检测、人脸识别、图像分割等方面有着广泛的应用。例如,通过深度学习技术,可以训练神经网络来识别图像中的对象、人脸或者场景,用于智能监控、自动驾驶、医学影像分析等领域。 自然语言处理: 机器学习在自然语言处理领域有着重要的应用,包括文本分类、情感分析、机器翻译、语音识别等。例如,通过深度学习模型,可以训练神经网络来理解和生成自然语言,用于智能客服、智能助手、机器翻译等场景。 推荐系统: 推荐系统利用机器学习算法分析用户的行为和偏好,为用户推荐个性化的产品或服务。例如,电商网站可以利用机器学习算法分析用户的购买历史和浏览行为,向用户推荐感兴趣的商品。 预测和预测分析: 机器学习可以用于预测未来事件的发生概率或者趋势。例如,金融领域可以利用机器学习算法进行股票价格预测、信用评分、欺诈检测等。 医疗诊断和生物信息学: 机器学习在医疗诊断、药物研发、基因组学等领域有着重要的应用。例如,可以利用机器学习算法分析医学影像数据进行疾病诊断,或者利用机器学习算法分析基因数据进行疾病风险预测。 智能交通和物联网: 机器学习可以应用于智能交通系统、智能城市管理和物联网等领域。例如,可以利用机器学习算法分析交通数据优化交通流量,或者利用机器学习算法分析传感器数据监测设备状态。 以上仅是机器学习应用的一部分,随着机器学习技术的不断发展和应用场景的不断拓展,机器学习在各个领域都有着重要的应用价值,并且正在改变我们的生活和工作方式。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值