在畫面上方的設計如下
系統的Log | 顯示登入資訊、登出鍵 |
公告:走馬燈 |
***網頁的設計畫面***
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MenuTop.aspx.cs" Inherits="MenuTop" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="refresh" content="180" />
<title></title>
<style type="text/css">
.auto-style0 {
width: 827px;
}
.auto-style1 {
height: 47px;
}
.auto-style2 {
width: 2%;
height: 15px;
}
.auto-style3 {
width: 50%;
}
</style>
</head>
<body style="background-image: url(../images/title_bg.png);margin: 0px; background-repeat: repeat-x;">
<form id="form1" runat="server">
<div>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td style="vertical-align:top;" class="auto-style0">
<img src="../images/logo.png" height="70px" />
</td>
<td style="vertical-align:bottom;text-align:right;">
<table width="100%">
<tr>
<td colspan="2" style="text-align: right;" class="auto-style1">
<asp:Label ID="LabUserName" runat="server" ></asp:Label>
<%--<a href="javascript:top.close();">Close</a><INPUT TYPE="button" VALUE="Close this Window" onClick="top.close();">--%>
<asp:LinkButton ID="LinkBtnLogOut" runat="server" onclick="LinkBtnLogOut_Click">登出</asp:LinkButton>
</td>
<td style="text-align: right; " class="auto-style2" >
<%-- <img src="../images/pig.png" style ="text-align:right;height:70px;" /> --%>
</td>
</tr>
<tr>
<td style="text-align: right; " class="auto-style3" >
<asp:Label ID="lblBullTitle" width="100%" runat="server" class="font_14b_b" Text="公告:"/>
</td>
<td style="text-align: right; " >
<marquee runat="server" id="mqSysBull" direction="left" scrolldelay="2" scrollamount="1" height="20">
<asp:Label ID="lblMessage" runat="server" CssClass ="font_14b_b" /></marquee>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
***程式的設計畫面***
using System;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections.Generic;
using SinoPac.WebExpress.Common;
using SinoPac.WebExpress.Common.Properties;
using SinoPac.WebExpress.DAO;
using SinoPac.WebExpress.Work;
public partial class MenuTop : SecurePage
{
string _TempDBName = "TempDB";
protected void Page_Load(object sender, EventArgs e)
{
//設定程式使用的參數
UserInfo oUser;
//設定程式使用的變數
oUser = UserInfo.getUserInfo();
LabUserName.Text = oUser.UserID + " " + oUser.UserName + " / " + oUser.DeptName + ' ' + oUser.OrganName + ",您好 ";
string strBullMsg;
//----這段為流程的copy方式,故每個系統應有自已的作法-----------------------------------------------------
//待辦清單
string strFlowIDList = "CFPMain,CFPMainSub";
//代理/助理過濾條件
string strProxyFullFilter = (Request["ProxyFullFilter"] != null) ? Request["ProxyFullFilter"].ToString() : "";
string strProxySemiFilter = (Request["ProxySemiFilter"] != null) ? Request["ProxySemiFilter"].ToString() : "";
//取得待辦的數量
strBullMsg = FlowExpress.getFlowTodoQty(FlowExpress.TodoListAssignKind.All, UserInfo.getUserInfo().UserID, strFlowIDList.Split(','), strProxyFullFilter, strProxySemiFilter).ToString();
if (oUser.IsBranch == "N")
{
strBullMsg = "您有" + strBullMsg + "筆待辦事項。 " + CheckMsg() + " 資料更新時間:" + DateTime.Now.ToString("HH:mm:ss");
}
else
{
strBullMsg = "";
}
lblMessage.Text = strBullMsg;
if (strBullMsg == "")
{
lblBullTitle.Text = "";
}
mqSysBull.Attributes["Title"] = strBullMsg;
}
protected void LinkBtnLogOut_Click(object sender, EventArgs e)
{
System.Web.Security.FormsAuthentication.SignOut();
Response.Write("<script language='javascript'>top.close();</" + "script>");
//System.Web.Security.FormsAuthentication.SignOut();
//System.Web.Security.FormsAuthentication.RedirectFromLoginPage("", false, "<script type='text/javascript' language='javascript'>alert('cccc');top.close();</" + "script>");
}
protected string CheckMsg() //讀取公告的資料
{
string returnmsg = "";
string strsql = "";
strsql += " select Announce from Sys_Announce ";
strsql += " WHERE Cast(SDat + ' ' + STime as Datetime) < GETDATE() AND Cast(EDat + ' ' + ETime as Datetime) > GETDATE() ";
strsql += " order by SDat,STime ";
DbHelper db = new DbHelper(_TempDBName);
DataTable dt = null;
CommandHelper sb = db.CreateCommandHelper();
sb.Reset();
sb.Append(strsql);
dt = db.ExecuteDataSet(sb.BuildCommand()).Tables[0];
for (int i = 0; i < dt.Rows.Count; i++)
{
returnmsg += dt.Rows[i]["Announce"].ToString();
}
return returnmsg;
}
}