2024-05-18 15:28:29 +08:00
using System ;
using System.Collections.Generic ;
using System.Linq ;
using System.Web ;
using System.Web.UI ;
using System.Web.UI.WebControls ;
using Maticsoft.Model ;
using System.Data ;
using System.Data.SqlClient ;
using Ajax ;
public partial class Framework_File_Console : System . Web . UI . Page
{
protected void Page_Load ( object sender , EventArgs e )
{
Utility . RegisterTypeForAjax ( typeof ( Framework_File_Console ) ) ;
if ( Session [ "user" ] = = null )
{
Response . Redirect ( "../index.aspx" ) ;
}
getuse ( ) ;
getgxxnr ( ) ;
getricheng ( ) ;
}
#region 获 取 加 载 菜 单 选 项 卡
private void getuse ( )
{
nr_z_yhzh zh = ( nr_z_yhzh ) Session [ "user" ] ;
usezh . InnerText = zh . zhanghao + ", " ;
RqYear . InnerText = DateTime . Now . Year . ToString ( ) ;
RqYr . InnerText = "年" + DateTime . Now . Month . ToString ( ) + "月" + DateTime . Now . Date . ToString ( "dd" ) + "日" ;
Rqsj . InnerText = DateTime . Now . ToString ( "HH:mm" ) ;
dbrq . Value = DateTime . Now . ToString ( "yyyy-MM-dd" ) ;
DataSet yhzhds = DBHlper . Execute ( "select * from dbo.view_nr_z_yhzh where isqiyong='启用'" ) ;
if ( yhzhds ! = null & & yhzhds . Tables [ 0 ] . Rows . Count > 0 )
{
richenglx . DataSource = yhzhds . Tables [ 0 ] . DefaultView ;
richenglx . DataValueField = "zhanghao" ;
richenglx . DataTextField = "zhanghao" ;
richenglx . DataBind ( ) ;
richenglx . Items . Insert ( 0 , new ListItem ( "新闻公告" , "新闻公告" ) ) ;
richenglx . Items . Insert ( 0 , new ListItem ( "我的日程" , "我的日程" ) ) ;
}
}
#endregion
#region 获 取 代 办 事 务
private void getgxxnr ( )
{
Maticsoft . Model . nr_z_yhzh user = ( Maticsoft . Model . nr_z_yhzh ) ( Session [ "user" ] ) ;
string htmlcode = "<div class='panel-heading'> 我的事务<div class='caret'></div> <a href='Console.aspx' title='刷新事务' class='pull-right'><span class='glyphicon glyphicon-refresh'></span></a> </div> " ;
string wherecode = string . Format ( "select top 7 * from view_nr_z_sysmsg where userid=" + user . id + " and msgval>0 order by riqi desc" ) ;
int txtssum = DBHlper . getcount ( "select sum(msgval) from view_nr_z_sysmsg where userid=" + user . id + " and msgval>0 " ) ;
int dbtxsum = DBHlper . getcount ( "select count(*) from view_nr_z_sysmsg where userid=" + user . id + " and msgval>0 and isview=0" ) ;
dbsxzts . InnerText = txtssum . ToString ( ) ;
dbsxwdts . InnerText = dbtxsum . ToString ( ) ;
DataTable rzdt = DBHlper . Execute ( wherecode ) . Tables [ 0 ] ;
for ( int i = 0 ; i < rzdt . Rows . Count ; i + + )
{
if ( rzdt . Rows [ i ] [ "msgtypeid" ] . ToString ( ) = = "10" )
{
string ids = shoukuan ( ) ;
if ( ids ! = "" )
{
htmlcode + = "<div class='panel-body'> "
+ "<div class='w15 pull-left'> <img src='img/noavatar_middle.gif' width='25' height='25' alt='图片' class='img-circle'> " + rzdt . Rows [ i ] [ "zhanghao" ] . ToString ( ) + " </div>"
+ "<div class='w55 pull-left'><a href='" + rzdt . Rows [ i ] [ "url" ] + "?ids=" + ids + "' >您当前有" + rzdt . Rows [ i ] [ "msgval" ] + rzdt . Rows [ i ] [ "msgtype" ] + "</a></div> <div class='w20 pull-left text-center'>" + Convert . ToDateTime ( rzdt . Rows [ i ] [ "riqi" ] ) . ToString ( "yyyy年MM月dd日 HH:mm:ss" ) + "</div>" ;
if ( rzdt . Rows [ i ] [ "msgval" ] . ToString ( ) = = "0" )
{
htmlcode + = "<div class='w10 pull-left text-center'><span class='text-green-main'>待处理</span></div> </div>" ;
} else {
htmlcode + = "<div class='w10 pull-left text-center'><span class='text-gray'>已关闭</span></div> </div>" ;
}
}
else
{
htmlcode + = "<div class='panel-body'> "
+ "<div class='w15 pull-left'> <img src='img/noavatar_middle.gif' width='25' height='25' alt='图片' class='img-circle'> " + rzdt . Rows [ i ] [ "zhanghao" ] . ToString ( ) + " </div>"
+ "<div class='w55 pull-left'><a href='" + rzdt . Rows [ i ] [ "url" ] + "' >您当前有" + rzdt . Rows [ i ] [ "msgval" ] + rzdt . Rows [ i ] [ "msgtype" ] + "</a></div> <div class='w20 pull-left text-center'>" + Convert . ToDateTime ( rzdt . Rows [ i ] [ "riqi" ] ) . ToString ( "yyyy年MM月dd日 HH:mm:ss" ) + "</div>" ;
if ( rzdt . Rows [ i ] [ "msgval" ] . ToString ( ) = = "0" )
{
htmlcode + = "<div class='w10 pull-left text-center'><span class='text-green-main'>待处理</span></div> </div>" ;
}
else
{
htmlcode + = "<div class='w10 pull-left text-center'><span class='text-gray'>已关闭</span></div> </div>" ;
}
}
}
else
{
htmlcode + = "<div class='panel-body'> "
+ "<div class='w15 pull-left'> <img src='img/noavatar_middle.gif' width='25' height='25' alt='图片' class='img-circle'> " + rzdt . Rows [ i ] [ "zhanghao" ] . ToString ( ) + " </div>"
+ "<div class='w55 pull-left'><a href='" + rzdt . Rows [ i ] [ "url" ] + "' >您当前有" + rzdt . Rows [ i ] [ "msgval" ] + rzdt . Rows [ i ] [ "msgtype" ] + "</a></div> <div class='w20 pull-left text-center'>" + Convert . ToDateTime ( rzdt . Rows [ i ] [ "riqi" ] ) . ToString ( "yyyy年MM月dd日 HH:mm:ss" ) + "</div>" ;
if ( rzdt . Rows [ i ] [ "msgval" ] . ToString ( ) = = "0" )
{
htmlcode + = "<div class='w10 pull-left text-center'><span class='text-green-main'>待处理</span></div> </div>" ;
}
else
{
htmlcode + = "<div class='w10 pull-left text-center'><span class='text-gray'>已关闭</span></div> </div>" ;
}
}
}
Myshiwudiv . InnerHtml = htmlcode + "<div class='panel-body text-center'> <a href='Message.aspx' style='color:#5297d6;'>查看全部</a> </div>" ;
}
#endregion
#region 获 取 日 程
private void getricheng ( )
{
nr_z_yhzh zh = ( nr_z_yhzh ) Session [ "user" ] ;
int dbzrcz = DBHlper . getcount ( " select count(*) from dbo.nr_z_Mricheng where rzname='" + zh . zhanghao + "'" ) ;
dbrczts . InnerText = dbzrcz . ToString ( ) ;
int dbrcdbtsz = 0 ;
string richengst = "<div class='panel-heading'> 我的日程统计<a href='Console.aspx' title='刷新日程' class='pull-right'><span class='glyphicon glyphicon-refresh'></span></a>"
+ " <a href='#' onclick='xgusermm()' title='添加日程' ><span class='glyphicon glyphicon-edit'></span></a></div> " ;
DataSet usds = DBHlper . Execute ( " select top 7 * from dbo.nr_z_Mricheng where rzname='" + zh . zhanghao + "' order by dbrq" ) ;
foreach ( DataRow r in usds . Tables [ 0 ] . Rows )
{
string rcbt = r [ "rzbt" ] . ToString ( ) ;
if ( rcbt . Length > 10 )
{
rcbt = rcbt . Substring ( 0 , 10 ) + "..." ;
}
richengst + = "<div class='panel-body'> <div class='w50 pull-left'><a href='#' title='删除日程' onclick='deleterc(" + r [ "id" ] + ")' ><span class='glyphicon glyphicon-trash'></span></a><a href='Schedule.aspx' >  " + rcbt + "</a></div>"
+ "<div class='w20 pull-left text-center'>" + Convert . ToDateTime ( r [ "dbrq" ] ) . ToString ( "yyyy年MM月dd日" ) + "</div> <div class='w15 pull-left text-center'>" + r [ "rzname" ] + "</div>" ;
if ( Convert . ToDateTime ( r [ "dbrq" ] ) . ToString ( "yyyy-MM-dd" ) = = DateTime . Now . ToString ( "yyyy-MM-dd" ) )
{
dbrcdbtsz = dbrcdbtsz + 1 ;
richengst + = "<div class='w10 pull-left text-center'><span class='text-yellow-main'>待处理</span></div> </div>" ;
}
else
{
richengst + = "<div class='w10 pull-left text-center'><span class='text-green-main'>待处理</span></div> </div>" ;
}
}
richengst + = "<div class='panel-body text-center'> <a href='Schedule.aspx' style='color:#5297d6;'>查看全部</a> </div>" ;
Myricheng . InnerHtml = richengst ;
dbrcdbts . InnerText = dbrcdbtsz . ToString ( ) ;
int xwggzslz = DBHlper . getcount ( " select count(*) from dbo.nr_z_Mricheng where lx='新闻公告'" ) ;
xwggzsl . InnerHtml = xwggzslz . ToString ( ) ;
int xwggdbslz = DBHlper . getcount ( " select count(*) from dbo.nr_z_Mricheng where lx='新闻公告' and dbrq='" + DateTime . Now . ToString ( "yyyy-MM-dd" ) + "'" ) ;
xwggdbsl . InnerHtml = xwggdbslz . ToString ( ) ;
int grxxztsz = DBHlper . getcount ( " select count(*) from dbo.nr_z_Mricheng where lx='" + zh . zhanghao + "'" ) ;
grxxzts . InnerHtml = grxxztsz . ToString ( ) ;
int grxxwdtsz = DBHlper . getcount ( " select count(*) from dbo.nr_z_Mricheng where lx='" + zh . zhanghao + "' and dbrq='" + DateTime . Now . ToString ( "yyyy-MM-dd" ) + "'" ) ;
grxxwdts . InnerHtml = grxxwdtsz . ToString ( ) ;
}
#endregion
#region 获 取 收 款
protected string shoukuan ( )
{
Maticsoft . Model . nr_z_yhzh user = ( Maticsoft . Model . nr_z_yhzh ) ( Session [ "user" ] ) ;
int juese = user . juese ;
int ts = 0 ;
string ids = "" ;
DataTable dt = new DataTable ( ) ;
2024-05-21 15:05:24 +08:00
if ( DBHlper . GetPermission ( juese , "订单管理" , "nr_z_dd" , "查看全部" ) )
2024-05-18 15:28:29 +08:00
{
ts = 0 ;
2024-05-21 15:05:24 +08:00
if ( DBHlper . GetPermission ( juese , "订单收款" , "nr_z_dd_fysk" , "查看个人" ) )
2024-05-18 15:28:29 +08:00
{
ts = DBHlper . getcount ( "select COUNT(*) from view_nr_z_dd as dd,view_nr_z_dd_wfkd as ddsk where dd.jzrq>='" + DateTime . Now . ToShortDateString ( ) + "' and ddsk.wsje>0 and dd.bh=ddsk.bh and ddsk.ywy='" + user . zhanghao + "'" ) ;
if ( ts > 0 )
{
dt = DBHlper . Execute ( "select ddsk.id from view_nr_z_dd as dd,view_nr_z_dd_wfkd as ddsk where dd.jzrq>='" + DateTime . Now . ToShortDateString ( ) + "' and ddsk.wsje>0 and dd.bh=ddsk.bh and ddsk.ywy='" + user . zhanghao + "'" ) . Tables [ 0 ] ;
if ( dt . Rows . Count > 0 )
{
foreach ( DataRow dr in dt . Rows )
{
ids + = dr [ "id" ] + "," ;
}
}
}
}
2024-05-21 15:05:24 +08:00
else if ( DBHlper . GetPermission ( juese , "订单收款" , "nr_z_dd_fysk" , "查看全部" ) )
2024-05-18 15:28:29 +08:00
{
ts = DBHlper . getcount ( "select COUNT(*) from view_nr_z_dd as dd,view_nr_z_dd_wfkd as ddsk where dd.jzrq>='" + DateTime . Now . ToShortDateString ( ) + "' and ddsk.wsje>0 and dd.bh=ddsk.bh" ) ;
if ( ts > 0 )
{
dt = DBHlper . Execute ( "select ddsk.id from view_nr_z_dd as dd,view_nr_z_dd_wfkd as ddsk where dd.jzrq>='" + DateTime . Now . ToShortDateString ( ) + "' and ddsk.wsje>0 and dd.bh=ddsk.bh" ) . Tables [ 0 ] ;
if ( dt . Rows . Count > 0 )
{
foreach ( DataRow dr in dt . Rows )
{
ids + = dr [ "id" ] + "," ;
}
}
}
}
}
ids = ids . TrimEnd ( ',' ) ;
return ids ;
}
#endregion
#region 添 加 日 程
[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
public int setricheng ( string rcbt , string rcnr , string dbrq , string rizhilx )
{
Maticsoft . Model . nr_z_yhzh user = ( Maticsoft . Model . nr_z_yhzh ) Session [ "user" ] ;
int setz = DBHlper . excutecmd ( "insert into nr_z_Mricheng (rzbt,rznr,dbrq,rzname,lx) values ('" + rcbt + "','" + rcnr + "','" + dbrq + "','" + user . zhanghao + "','" + rizhilx + "')" ) ;
return setz ;
}
#endregion
#region 删 除 日 程
[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
public int deleterc ( string rcid )
{
int setz = DBHlper . excutecmd ( "delete nr_z_Mricheng where id='" + rcid + "'" ) ;
return setz ;
}
#endregion
}