129 lines
5.1 KiB
C#
129 lines
5.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using Business = SuperMap.RealEstate.Finance.Storage.Business;
|
|
using HWSB = SuperMap.RealEstate.HighWay.Storage.Business;
|
|
using HZQR.Common;
|
|
using SuperMap.RealEstate.CoreFrameWork;
|
|
using SuperMap.RealEstate.Web.Utility;
|
|
using SuperMap.RealEstate.Web.UI.WebControls;
|
|
using System.Data;
|
|
|
|
namespace Personnel.WebSite.Modules.Leave
|
|
{
|
|
public partial class StaffLeaveDetail : SuperMap.RealEstate.Web.UI.Page
|
|
{
|
|
public string sqlWhere = "";
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (IsPostBack) return;
|
|
|
|
if (string.IsNullOrEmpty(Request["StartDate"]))
|
|
{
|
|
txtStarTime.Text = DateTime.Now.AddDays(1 - DateTime.Now.Day).ToString("yyyy-MM-dd");
|
|
}
|
|
else
|
|
{
|
|
txtStarTime.Text = Request["StartDate"].ToDecrypt();
|
|
}
|
|
|
|
if (string.IsNullOrEmpty(Request["EndDate"]))
|
|
{
|
|
txtEndTime.Text = DateTime.Now.ToString("yyyy-MM-dd");
|
|
}
|
|
else
|
|
{
|
|
txtEndTime.Text = Request["EndDate"].ToDecrypt();
|
|
}
|
|
|
|
|
|
//请假类型
|
|
LEAVE_TYPE.Items.Clear();
|
|
this.LEAVE_TYPE.Items.Add(new ListItemEx
|
|
{
|
|
Value = "",
|
|
Text = "全部"
|
|
});
|
|
DictionaryHelper.BindingDropDownList("LEAVE_TYPE", LEAVE_TYPE.Items, this.Transaction);
|
|
//初始化并加载列表
|
|
GridViewEx1.SelectingWithInit<Business.LEAVE>(ObjectDataSource1, GridPageEx1,
|
|
DictionaryHelper.GetDictionary(Transaction, "LEAVE_TYPE").AsNewKeys("LEAVE_TYPE"));
|
|
//设置回车焦点按钮
|
|
SetControlClientAction(ButtonSearch);
|
|
}
|
|
|
|
//查询
|
|
protected void ButtonSearch_CallBackClick(object sender, ClientSetEventArgs e)
|
|
{
|
|
GridViewEx1.Selecting<Business.LEAVE>(ObjectDataSource1, GridPageEx1);
|
|
//设置UI变化
|
|
e.SetValue(GridViewEx1);
|
|
e.SetValue(GridPageEx1);
|
|
}
|
|
|
|
//翻页事件
|
|
protected void GridPageEx1_CallBackPageChanged(object src, ClientSetEventArgs e)
|
|
{
|
|
GridViewEx1.Pagging<Business.LEAVE>(ObjectDataSource1, GridPageEx1);
|
|
//设置UI变化
|
|
e.SetValue(GridViewEx1);
|
|
}
|
|
|
|
//查询SQL设置
|
|
protected void GridViewEx1_SelectMethodParameters(object sender, SelectMethodParametersArgs e)
|
|
{
|
|
//搜索选项的搜索条件过滤
|
|
if (!string.IsNullOrEmpty(TextBox_Search.Text))
|
|
e.AddOrParams(GridViewSearch1, TextBox_Search.Text);
|
|
if (!string.IsNullOrEmpty(Request["STAFF_ID"]))
|
|
{
|
|
e.AddAndParams("STAFF_ID", Request["STAFF_ID"].ToDecryptInt32());//员工Id
|
|
}
|
|
//服务区筛选条件
|
|
if (string.IsNullOrWhiteSpace(Request["SERVERPART_ID"]))
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(Request["FIELDENUM_ID"]))
|
|
{
|
|
//查询区域权限
|
|
string _FIELDENUM_ID = Request["FIELDENUM_ID"].ToDecrypt();
|
|
new HWSB.SERVERPART(Transaction).GetSubServerpart(ref _FIELDENUM_ID, _FIELDENUM_ID, "");
|
|
e.SetOtherUserCustomWhereSqlString += (e.SetOtherUserCustomWhereSqlString == "" ? "" : " AND ") +
|
|
"SERVERPART_ID IN (SELECT SERVERPART_ID FROM HIGHWAY_STORAGE.T_SERVERPART WHERE FIELDENUM_ID IN (" + _FIELDENUM_ID + "))";
|
|
}
|
|
}
|
|
else if (!string.IsNullOrWhiteSpace(Request["SERVERPART_ID"]))
|
|
{
|
|
//默认读取用户服务区权限集合
|
|
e.SetOtherUserCustomWhereSqlString += (e.SetOtherUserCustomWhereSqlString == "" ? "" : " AND ") +
|
|
"SERVERPART_ID IN (" + Request["SERVERPART_ID"].ToDecrypt() + ")";
|
|
}
|
|
|
|
if (LEAVE_TYPE.SelectedValue != "" && LEAVE_TYPE.SelectedValue != "1=1")
|
|
{
|
|
e.AddAndParams("LEAVE_TYPE", LEAVE_TYPE.SelectedValue);//假期类型
|
|
}
|
|
|
|
#region 假期开始时间
|
|
e.SetOtherUserCustomWhereSqlString +=
|
|
e.SetOtherUserCustomWhereSqlString += (e.SetOtherUserCustomWhereSqlString == "" ? "" : " AND ") +
|
|
string.Format(@" LEAVE_STARTDATE >= TO_DATE('{0}', 'yyyy-mm-dd hh24:mi:ss') AND
|
|
LEAVE_STARTDATE <= TO_DATE('{1}','yyyy-mm-dd hh24:mi:ss') +1 ", txtStarTime.Text, txtEndTime.Text);
|
|
|
|
#endregion
|
|
//排序
|
|
e.AddOrderByParams(GridViewOrderBy1);
|
|
//计算汇总的条件
|
|
sqlWhere = e.WhereSqlString;
|
|
foreach (var item in e.Parameters)
|
|
{
|
|
string oldVal = ":" + item.Key;
|
|
string newVal = item.Value.ToString();
|
|
sqlWhere = sqlWhere.Replace(oldVal, "'" + newVal + "'");
|
|
}
|
|
}
|
|
}
|
|
}
|