提交代码

This commit is contained in:
2024-03-18 09:08:16 +08:00
parent 1210be8ad0
commit b925c6d1e7
49 changed files with 4765 additions and 2387 deletions
@@ -0,0 +1,100 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BusinessTrip.aspx.cs" Inherits="FineUIPro.Web.Personal.BusinessTrip" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>出差记录</title>
<link href="../res/css/common.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="出差记录" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="BusinessTripId" EnableColumnLines="true" DataIDField="BusinessTripId"
AllowSorting="true" SortField="ArriveDate" SortDirection="DESC" OnSort="Grid1_Sort"
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True">
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" runat="server">
<Items>
<f:TextBox runat="server" Label="姓名" ID="txtUserName" EmptyText="输入查询条件"
AutoPostBack="true" OnTextChanged="TextBox_TextChanged" Width="250px" LabelWidth="50px"></f:TextBox>
<f:RadioButtonList runat="server" ID="rblType" Label="出差类型" LabelWidth="100px" LabelAlign="Right" Width="350px" AutoPostBack="true" OnSelectedIndexChanged="rblType_SelectedIndexChanged">
<f:RadioItem Text="全部" Value="0" Selected="true" />
<f:RadioItem Text="项目出差" Value="1" />
<f:RadioItem Text="其他出差" Value="2" />
</f:RadioButtonList>
<f:ToolbarFill ID="ToolbarFill1" runat="server"></f:ToolbarFill>
<f:Button ID="btnNew" ToolTip="新增" Icon="Add" EnablePostBack="true" OnClick="btnNew_Click" runat="server"
Hidden="true">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
<Columns>
<f:RowNumberField EnablePagingNumber="true" HeaderText="序号" Width="50px" HeaderTextAlign="Center" TextAlign="Center"/>
<f:RenderField Width="180px" ColumnID="TypeStr" DataField="TypeStr"
FieldType="String" HeaderText="出差类型" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="UserName" DataField="UserName"
FieldType="String" HeaderText="姓名" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:RenderField Width="200px" ColumnID="ProjectName" DataField="ProjectName" ExpandUnusedSpace="true"
FieldType="String" HeaderText="项目名称" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:RenderField Width="120px" ColumnID="ArriveDate" DataField="ArriveDate"
FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd" HeaderText="到达日期"
HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:RenderField Width="120px" ColumnID="LeaveDate" DataField="LeaveDate"
FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd" HeaderText="离开日期"
HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
</Columns>
<Listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
</Listeners>
<PageItems>
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
</f:ToolbarSeparator>
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
</f:ToolbarText>
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
</f:DropDownList>
</PageItems>
</f:Grid>
</Items>
</f:Panel>
<f:Window ID="Window1" Title="员工出差记录" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Self" EnableResize="false" runat="server" IsModal="true" OnClose="Window1_Close"
Width="550px" Height="300px">
</f:Window>
<f:Menu ID="Menu1" runat="server">
<f:MenuButton ID="btnMenuEdit" OnClick="btnMenuEdit_Click" EnablePostBack="true"
Hidden="true" runat="server" Text="编辑" Icon="Pencil">
</f:MenuButton>
<f:MenuButton ID="btnMenuDelete" OnClick="btnMenuDelete_Click" EnablePostBack="true"
Hidden="true" ConfirmText="删除选中行?" ConfirmTarget="Parent" runat="server" Text="删除"
Icon="Delete">
</f:MenuButton>
</f:Menu>
</form>
<script type="text/jscript">
var menuID = '<%= Menu1.ClientID %>';
// 返回false,来阻止浏览器右键菜单
function onRowContextMenu(event, rowId) {
F(menuID).show(); //showAt(event.pageX, event.pageY);
return false;
}
function reloadGrid() {
__doPostBack(null, 'reloadGrid');
}
</script>
</body>
</html>
@@ -0,0 +1,228 @@
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
namespace FineUIPro.Web.Personal
{
public partial class BusinessTrip : PageBase
{
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Funs.DropDownPageSize(this.ddlPageSize);
if (this.CurrUser != null && this.CurrUser.PageSize.HasValue)
{
Grid1.PageSize = this.CurrUser.PageSize.Value;
}
this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
// 绑定表格
this.BindGrid();
////权限按钮方法
this.GetButtonPower();
}
}
/// <summary>
/// 绑定数据
/// </summary>
private void BindGrid()
{
string strSql = @"SELECT trip.BusinessTripId,trip.ProjectId,trip.UserId,trip.ArriveDate,trip.LeaveDate,Users.UserName,Project.ProjectName,case trip.Type when '1' then '项目出差' when '2' then '其他出差' else '' end AS TypeStr "
+ @" From dbo.Person_BusinessTrip AS trip"
+ @" LEFT JOIN Sys_User AS Users ON Users.UserId=trip.UserId"
+ @" LEFT JOIN Base_Project AS Project ON Project.ProjectId=trip.ProjectId"
+ @" WHERE 1=1";
List<SqlParameter> listStr = new List<SqlParameter>();
if (this.rblType.SelectedValue!="0")
{
strSql += " AND trip.Type = @Type";
listStr.Add(new SqlParameter("@Type", this.rblType.SelectedValue));
}
if (this.CurrUser.UserId != BLL.Const.sysglyId && this.CurrUser.UserId != BLL.Const.hfnbdId)
{
strSql += " AND trip.UserId = @UserId";
listStr.Add(new SqlParameter("@UserId", this.CurrUser.UserId));
}
if (!string.IsNullOrEmpty(this.txtUserName.Text.Trim()))
{
strSql += " AND UserName LIKE @UserName";
listStr.Add(new SqlParameter("@UserName", "%" + this.txtUserName.Text.Trim() + "%"));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
if (this.rblType.SelectedValue == "0" || this.rblType.SelectedValue == "1")
{
this.Grid1.Columns[3].Hidden = false;
}
else
{
this.Grid1.Columns[3].Hidden = true;
}
}
#region
/// <summary>
/// 分页
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
BindGrid();
}
/// <summary>
/// 分页显示条数下拉框
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid();
}
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
{
BindGrid();
}
#endregion
#region
/// <summary>
/// 批量删除数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
var trip = Person_BusinessTripService.GetPersonBusinessTripById(rowID);
if (trip != null)
{
BLL.Person_BusinessTripService.DeletePersonBusinessTrip(rowID);
}
}
BindGrid();
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
}
else
{
ShowNotify("请至少选中一行!", MessageBoxIcon.Warning);
}
}
#endregion
protected void btnNew_Click(object sender, EventArgs e)
{
var noEndTrip = (from x in Funs.DB.Person_BusinessTrip where x.UserId == this.CurrUser.UserId && (x.ArriveDate == null || x.LeaveDate == null) select x).FirstOrDefault();
if (noEndTrip != null)
{
ShowNotify("尚有一条记录到达/离开日期为空,请先完善信息后再新增出差记录!", MessageBoxIcon.Warning);
return;
}
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("BusinessTripEdit.aspx", "编辑 - ")));
}
#region
/// <summary>
/// 编辑
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
string Id = Grid1.SelectedRowID;
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("BusinessTripEdit.aspx?BusinessTripId={0}", Id, "编辑 - ")));
}
/// <summary>
/// Grid行双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
btnMenuEdit_Click(null, null);
}
#endregion
#region
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void TextBox_TextChanged(object sender, EventArgs e)
{
this.BindGrid();
}
#endregion
#region
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="button"></param>
/// <returns></returns>
private void GetButtonPower()
{
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.BusinessTripMenuId);
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnAdd))
{
this.btnNew.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnModify))
{
this.btnMenuEdit.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnDelete))
{
this.btnMenuDelete.Hidden = false;
}
}
}
#endregion
protected void Window1_Close(object sender, EventArgs e)
{
BindGrid();
}
protected void rblType_SelectedIndexChanged(object sender, EventArgs e)
{
BindGrid();
}
}
}
+159
View File
@@ -0,0 +1,159 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.Personal {
public partial class BusinessTrip {
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// Grid1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// Toolbar2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar2;
/// <summary>
/// txtUserName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtUserName;
/// <summary>
/// rblType 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.RadioButtonList rblType;
/// <summary>
/// ToolbarFill1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
/// <summary>
/// btnNew 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnNew;
/// <summary>
/// ToolbarSeparator1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
/// <summary>
/// ToolbarText1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarText ToolbarText1;
/// <summary>
/// ddlPageSize 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList ddlPageSize;
/// <summary>
/// Window1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window1;
/// <summary>
/// Menu1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Menu Menu1;
/// <summary>
/// btnMenuEdit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuEdit;
/// <summary>
/// btnMenuDelete 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuDelete;
}
}
@@ -0,0 +1,57 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BusinessTripEdit.aspx.cs" Inherits="FineUIPro.Web.Personal.BusinessTripEdit" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="../res/css/common.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="SimpleForm1" runat="server" />
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true" LabelWidth="140px"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Rows>
<f:FormRow>
<Items>
<f:RadioButtonList runat="server" ID="rblType" Label="出差类型" LabelWidth="100px" LabelAlign="Right" AutoPostBack="true" OnSelectedIndexChanged="rblType_SelectedIndexChanged">
<f:RadioItem Text="项目出差" Value="1" Selected="true" />
<f:RadioItem Text="其他出差" Value="2" />
</f:RadioButtonList>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:Label ID="lbUserName" runat="server" Label="姓名" LabelWidth="100px" LabelAlign="Right"></f:Label>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownList ID="drpProject" runat="server" Label="项目" Width="300px" LabelWidth="100px" LabelAlign="Right"
EnableEdit="true">
</f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DatePicker runat="server" Label="到达日期" ID="txtArriveDate" LabelWidth="100px" LabelAlign="Right"></f:DatePicker>
<f:DatePicker runat="server" Label="离开日期" ID="txtLeaveDate" LabelWidth="100px" LabelAlign="Right"></f:DatePicker>
</Items>
</f:FormRow>
</Rows>
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Bottom" ToolbarAlign="Right" runat="server">
<Items>
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ValidateForms="SimpleForm1"
OnClick="btnSave_Click">
</f:Button>
<f:Button ID="btnClose" EnablePostBack="false" ToolTip="关闭" runat="server" Icon="SystemClose">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
</f:Form>
</form>
</body>
</html>
@@ -0,0 +1,129 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using Model;
namespace FineUIPro.Web.Personal
{
public partial class BusinessTripEdit : PageBase
{
/// <summary>
/// 定义项
/// </summary>
public string BusinessTripId
{
get
{
return (string)ViewState["BusinessTripId"];
}
set
{
ViewState["BusinessTripId"] = value;
}
}
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
ProjectService.InitAllProjectDropDownList(this.drpProject, true);
this.BusinessTripId = Request.QueryString["BusinessTripId"];
if (!String.IsNullOrEmpty(this.BusinessTripId))
{
var trip = BLL.Person_BusinessTripService.GetPersonBusinessTripById(this.BusinessTripId);
if (trip != null)
{
if (!string.IsNullOrEmpty(trip.Type))
{
this.rblType.SelectedValue = trip.Type;
}
if (this.rblType.SelectedValue == "1")
{
this.drpProject.Hidden = false;
}
else
{
this.drpProject.Hidden = true;
}
this.lbUserName.Text = BLL.UserService.GetUserNameByUserId(trip.UserId);
if (!string.IsNullOrEmpty(trip.ProjectId))
{
this.drpProject.SelectedValue = trip.ProjectId;
}
if (trip.ArriveDate != null)
{
this.txtArriveDate.Text = string.Format("{0:yyyy-MM-dd}", trip.ArriveDate);
}
if (trip.LeaveDate != null)
{
this.txtLeaveDate.Text = string.Format("{0:yyyy-MM-dd}", trip.LeaveDate);
}
}
}
else
{
this.lbUserName.Text = this.CurrUser.UserName;
}
}
}
/// <summary>
/// 保存数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
if (this.drpProject.SelectedValue == BLL.Const._Null && this.rblType.SelectedValue == "1")
{
Alert.ShowInParent("请选择项目!", MessageBoxIcon.Warning);
return;
}
Model.Person_BusinessTrip newTrip = new Model.Person_BusinessTrip()
{
Type = this.rblType.SelectedValue,
UserId = this.CurrUser.UserId,
ProjectId = this.drpProject.SelectedValue,
ArriveDate = Funs.GetNewDateTime(this.txtArriveDate.Text),
LeaveDate = Funs.GetNewDateTime(this.txtLeaveDate.Text),
};
if (!string.IsNullOrEmpty(this.BusinessTripId))
{
newTrip.BusinessTripId = this.BusinessTripId;
BLL.Person_BusinessTripService.UpdatePersonBusinessTrip(newTrip);
BLL.LogService.AddSys_Log(this.CurrUser, null, newTrip.BusinessTripId, BLL.Const.BusinessTripMenuId, BLL.Const.BtnAdd);
}
else
{
newTrip.BusinessTripId = SQLHelper.GetNewID();
BLL.Person_BusinessTripService.AddPersonBusinessTrip(newTrip);
BLL.LogService.AddSys_Log(this.CurrUser, null, newTrip.BusinessTripId, BLL.Const.BusinessTripMenuId, BLL.Const.BtnModify);
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
protected void rblType_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.rblType.SelectedValue == "1")
{
this.drpProject.Hidden = false;
}
else
{
this.drpProject.Hidden = true;
}
}
}
}
@@ -0,0 +1,114 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.Personal {
public partial class BusinessTripEdit {
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// SimpleForm1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// rblType 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.RadioButtonList rblType;
/// <summary>
/// lbUserName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label lbUserName;
/// <summary>
/// drpProject 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpProject;
/// <summary>
/// txtArriveDate 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtArriveDate;
/// <summary>
/// txtLeaveDate 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtLeaveDate;
/// <summary>
/// Toolbar1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// btnSave 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSave;
/// <summary>
/// btnClose 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnClose;
}
}
@@ -0,0 +1,103 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestRunPerformance.aspx.cs" Inherits="FineUIPro.Web.Personal.TestRunPerformance" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>开车绩效记录</title>
<link href="../res/css/common.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="开车绩效记录" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="TestRunPerformanceId" EnableColumnLines="true" DataIDField="TestRunPerformanceId"
AllowSorting="true" SortField="Months" SortDirection="DESC" OnSort="Grid1_Sort" ForceFit="true"
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True">
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" runat="server">
<Items>
<f:TextBox runat="server" Label="姓名" ID="txtUserName" EmptyText="输入查询条件"
AutoPostBack="true" OnTextChanged="TextBox_TextChanged" Width="250px" LabelWidth="50px"></f:TextBox>
<f:ToolbarFill ID="ToolbarFill1" runat="server"></f:ToolbarFill>
<f:Button ID="btnNew" ToolTip="新增" Icon="Add" EnablePostBack="true" OnClick="btnNew_Click" runat="server"
Hidden="true">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
<Columns>
<f:RowNumberField EnablePagingNumber="true" HeaderText="序号" Width="50px" HeaderTextAlign="Center" TextAlign="Center"/>
<f:RenderField Width="100px" ColumnID="UserName" DataField="UserName"
FieldType="String" HeaderText="姓名" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="Months" DataField="Months"
FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM" HeaderText="月份"
HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:RenderField Width="400px" ColumnID="ProjectName" DataField="ProjectName"
FieldType="String" HeaderText="工作地点" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:RenderField Width="400px" ColumnID="JobContent" DataField="JobContent"
FieldType="String" HeaderText="工作内容" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="Type" DataField="Type"
FieldType="String" HeaderText="工作类别" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:RenderField Width="150px" ColumnID="Item" DataField="Item"
FieldType="String" HeaderText="工作项" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="Unit" DataField="Unit"
FieldType="String" HeaderText="计量单位" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="Days" DataField="Days"
FieldType="String" HeaderText="标准工作日" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
</Columns>
<Listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
</Listeners>
<PageItems>
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
</f:ToolbarSeparator>
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
</f:ToolbarText>
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
</f:DropDownList>
</PageItems>
</f:Grid>
</Items>
</f:Panel>
<f:Window ID="Window1" Title="员工开车绩效记录" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Self" EnableResize="false" runat="server" IsModal="true" OnClose="Window1_Close"
Width="1300px" Height="500px">
</f:Window>
<f:Menu ID="Menu1" runat="server">
<f:MenuButton ID="btnMenuEdit" OnClick="btnMenuEdit_Click" EnablePostBack="true"
Hidden="true" runat="server" Text="编辑" Icon="Pencil">
</f:MenuButton>
<f:MenuButton ID="btnMenuDelete" OnClick="btnMenuDelete_Click" EnablePostBack="true"
Hidden="true" ConfirmText="删除选中行?" ConfirmTarget="Parent" runat="server" Text="删除"
Icon="Delete">
</f:MenuButton>
</f:Menu>
</form>
<script type="text/jscript">
var menuID = '<%= Menu1.ClientID %>';
// 返回false,来阻止浏览器右键菜单
function onRowContextMenu(event, rowId) {
F(menuID).show(); //showAt(event.pageX, event.pageY);
return false;
}
function reloadGrid() {
__doPostBack(null, 'reloadGrid');
}
</script>
</body>
</html>
@@ -0,0 +1,205 @@
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
namespace FineUIPro.Web.Personal
{
public partial class TestRunPerformance : PageBase
{
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Funs.DropDownPageSize(this.ddlPageSize);
if (this.CurrUser != null && this.CurrUser.PageSize.HasValue)
{
Grid1.PageSize = this.CurrUser.PageSize.Value;
}
this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
// 绑定表格
this.BindGrid();
////权限按钮方法
this.GetButtonPower();
}
}
/// <summary>
/// 绑定数据
/// </summary>
private void BindGrid()
{
string strSql = @"SELECT performance.TestRunPerformanceId,performance.ProjectId,performance.UserId,performance.Months,performance.JobContent,performance.TestRunPerformanceStandardId,Users.UserName,case when performance.ProjectId='0' then '本部' else Project.ProjectName end as ProjectName,Standard.Type,Standard.Item,Standard.Unit,Standard.Days "
+ @" From dbo.Person_TestRunPerformance AS performance"
+ @" LEFT JOIN Sys_User AS Users ON Users.UserId=performance.UserId"
+ @" LEFT JOIN Base_Project AS Project ON Project.ProjectId=performance.ProjectId"
+ @" LEFT JOIN Base_TestRunPerformanceStandard AS Standard ON Standard.TestRunPerformanceStandardId=performance.TestRunPerformanceStandardId"
+ @" WHERE 1=1";
List<SqlParameter> listStr = new List<SqlParameter>();
if (this.CurrUser.UserId != BLL.Const.sysglyId && this.CurrUser.UserId != BLL.Const.hfnbdId)
{
strSql += " AND performance.UserId = @UserId";
listStr.Add(new SqlParameter("@UserId", this.CurrUser.UserId));
}
if (!string.IsNullOrEmpty(this.txtUserName.Text.Trim()))
{
strSql += " AND UserName LIKE @UserName";
listStr.Add(new SqlParameter("@UserName", "%" + this.txtUserName.Text.Trim() + "%"));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
}
#region
/// <summary>
/// 分页
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
BindGrid();
}
/// <summary>
/// 分页显示条数下拉框
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid();
}
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
{
BindGrid();
}
#endregion
#region
/// <summary>
/// 批量删除数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
var performance = Person_TestRunPerformanceService.GetPersonTestRunPerformanceById(rowID);
if (performance != null)
{
BLL.Person_TestRunPerformanceService.DeletePersonTestRunPerformance(rowID);
}
}
BindGrid();
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
}
else
{
ShowNotify("请至少选中一行!", MessageBoxIcon.Warning);
}
}
#endregion
protected void btnNew_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TestRunPerformanceEdit.aspx", "编辑 - ")));
}
#region
/// <summary>
/// 编辑
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
string Id = Grid1.SelectedRowID;
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TestRunPerformanceEdit.aspx?TestRunPerformanceId={0}", Id, "编辑 - ")));
}
/// <summary>
/// Grid行双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
btnMenuEdit_Click(null, null);
}
#endregion
#region
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void TextBox_TextChanged(object sender, EventArgs e)
{
this.BindGrid();
}
#endregion
#region
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="button"></param>
/// <returns></returns>
private void GetButtonPower()
{
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.TestRunPerformanceMenuId);
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnAdd))
{
this.btnNew.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnModify))
{
this.btnMenuEdit.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnDelete))
{
this.btnMenuDelete.Hidden = false;
}
}
}
#endregion
protected void Window1_Close(object sender, EventArgs e)
{
BindGrid();
}
}
}
@@ -0,0 +1,150 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.Personal {
public partial class TestRunPerformance {
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// Grid1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// Toolbar2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar2;
/// <summary>
/// txtUserName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtUserName;
/// <summary>
/// ToolbarFill1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
/// <summary>
/// btnNew 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnNew;
/// <summary>
/// ToolbarSeparator1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
/// <summary>
/// ToolbarText1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarText ToolbarText1;
/// <summary>
/// ddlPageSize 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList ddlPageSize;
/// <summary>
/// Window1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window1;
/// <summary>
/// Menu1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Menu Menu1;
/// <summary>
/// btnMenuEdit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuEdit;
/// <summary>
/// btnMenuDelete 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuDelete;
}
}
@@ -0,0 +1,67 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestRunPerformanceEdit.aspx.cs" Inherits="FineUIPro.Web.Personal.TestRunPerformanceEdit" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="../res/css/common.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="SimpleForm1" runat="server" />
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true" LabelWidth="140px"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Rows>
<f:FormRow>
<Items>
<f:DatePicker runat="server" Label="月份" ID="txtMonths" LabelWidth="100px" LabelAlign="Right" DisplayType="Month" DateFormatString="yyyy-MM"></f:DatePicker>
<f:Label ID="lbUserName" runat="server" Label="姓名" LabelWidth="100px" LabelAlign="Right"></f:Label>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownList ID="drpProject" runat="server" Label="工作地点" Width="300px" LabelWidth="100px" LabelAlign="Right"
EnableEdit="true">
</f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextArea runat="server" ID="txtJobContent" Label="工作内容" LabelWidth="100px" LabelAlign="Right"></f:TextArea>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownList ID="drpType" runat="server" Label="工作类别" Width="300px" LabelWidth="100px" LabelAlign="Right" AutoPostBack="true" OnSelectedIndexChanged="drpType_SelectedIndexChanged"
EnableEdit="true">
</f:DropDownList>
<f:DropDownList ID="drpItem" runat="server" Label="工作项" Width="300px" LabelWidth="100px" LabelAlign="Right" AutoPostBack="true" OnSelectedIndexChanged="drpItem_SelectedIndexChanged"
EnableEdit="true">
</f:DropDownList>
<f:DropDownList ID="drpUnit" runat="server" Label="计量单位" Width="300px" LabelWidth="100px" LabelAlign="Right" AutoPostBack="true" OnSelectedIndexChanged="drpUnit_SelectedIndexChanged"
EnableEdit="true">
</f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:NumberBox ID="txtDays" runat="server" Label="标准工作日" NoNegative="true" NoDecimal="true" LabelWidth="100px" LabelAlign="Right" Readonly="true"></f:NumberBox>
</Items>
</f:FormRow>
</Rows>
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Bottom" ToolbarAlign="Right" runat="server">
<Items>
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ValidateForms="SimpleForm1"
OnClick="btnSave_Click">
</f:Button>
<f:Button ID="btnClose" EnablePostBack="false" ToolTip="关闭" runat="server" Icon="SystemClose">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
</f:Form>
</form>
</body>
</html>
@@ -0,0 +1,208 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using Model;
namespace FineUIPro.Web.Personal
{
public partial class TestRunPerformanceEdit : PageBase
{
/// <summary>
/// 定义项
/// </summary>
public string TestRunPerformanceId
{
get
{
return (string)ViewState["TestRunPerformanceId"];
}
set
{
ViewState["TestRunPerformanceId"] = value;
}
}
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
ProjectService.InitAllProjectDropDownList2(this.drpProject, true);
this.TestRunPerformanceId = Request.QueryString["TestRunPerformanceId"];
TestRunPerformanceStandardService.InitTypeDropDownList(drpType, true);
Funs.FineUIPleaseSelect(this.drpItem);
Funs.FineUIPleaseSelect(this.drpUnit);
if (!String.IsNullOrEmpty(this.TestRunPerformanceId))
{
var performance = BLL.Person_TestRunPerformanceService.GetPersonTestRunPerformanceById(this.TestRunPerformanceId);
if (performance != null)
{
if (performance.Months != null)
{
this.txtMonths.Text = string.Format("{0:yyyy-MM-dd}", performance.Months);
}
this.lbUserName.Text = BLL.UserService.GetUserNameByUserId(performance.UserId);
if (!string.IsNullOrEmpty(performance.ProjectId))
{
this.drpProject.SelectedValue = performance.ProjectId;
}
this.txtJobContent.Text = performance.JobContent;
Model.Base_TestRunPerformanceStandard standard = BLL.TestRunPerformanceStandardService.GetPerformanceStandardById(performance.TestRunPerformanceStandardId);
if (standard != null)
{
this.drpType.SelectedValue = standard.Type;
TestRunPerformanceStandardService.InitItemDropDownList(drpItem, this.drpType.SelectedValue, true);
this.drpItem.SelectedValue = standard.Item;
TestRunPerformanceStandardService.InitUnitDropDownList(drpUnit, this.drpType.SelectedValue, this.drpItem.SelectedValue, true);
this.drpUnit.SelectedValue = standard.TestRunPerformanceStandardId;
}
if (performance.Days != null)
{
this.txtDays.Text = performance.Days.ToString();
}
}
}
else
{
this.lbUserName.Text = this.CurrUser.UserName;
}
}
}
/// <summary>
/// 保存数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.txtMonths.Text.Trim()))
{
Alert.ShowInParent("请选择月份!", MessageBoxIcon.Warning);
return;
}
if (this.drpProject.SelectedValue == BLL.Const._Null)
{
Alert.ShowInParent("请选择工作地点!", MessageBoxIcon.Warning);
return;
}
if (this.drpType.SelectedValue == BLL.Const._Null)
{
Alert.ShowInParent("请选择工作类别!", MessageBoxIcon.Warning);
return;
}
if (this.drpItem.SelectedValue == BLL.Const._Null)
{
Alert.ShowInParent("请选择工作项!", MessageBoxIcon.Warning);
return;
}
if (this.drpUnit.SelectedValue == BLL.Const._Null)
{
Alert.ShowInParent("请选择计量单位!", MessageBoxIcon.Warning);
return;
}
if (this.txtDays.Text.Trim() == "0" || string.IsNullOrEmpty(this.txtDays.Text.Trim()))
{
Alert.ShowInParent("请输入标准工作日!", MessageBoxIcon.Warning);
return;
}
Model.Person_TestRunPerformance newperformance = new Model.Person_TestRunPerformance()
{
Months = Funs.GetNewDateTimeOrNow(this.txtMonths.Text.Trim()),
UserId = this.CurrUser.UserId,
ProjectId = this.drpProject.SelectedValue,
JobContent = this.txtJobContent.Text.Trim(),
TestRunPerformanceStandardId = this.drpUnit.SelectedValue,
Days = Funs.GetNewInt(this.txtDays.Text.Trim()),
};
if (!string.IsNullOrEmpty(this.TestRunPerformanceId))
{
newperformance.TestRunPerformanceId = this.TestRunPerformanceId;
BLL.Person_TestRunPerformanceService.UpdatePersonTestRunPerformance(newperformance);
BLL.LogService.AddSys_Log(this.CurrUser, null, newperformance.TestRunPerformanceId, BLL.Const.TestRunPerformanceMenuId, BLL.Const.BtnAdd);
}
else
{
newperformance.TestRunPerformanceId = SQLHelper.GetNewID();
BLL.Person_TestRunPerformanceService.AddPersonTestRunPerformance(newperformance);
BLL.LogService.AddSys_Log(this.CurrUser, null, newperformance.TestRunPerformanceId, BLL.Const.TestRunPerformanceMenuId, BLL.Const.BtnModify);
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
protected void drpType_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.drpType.SelectedValue != BLL.Const._Null)
{
TestRunPerformanceStandardService.InitItemDropDownList(drpItem, this.drpType.SelectedValue, true);
this.drpItem.SelectedIndex = 0;
this.drpUnit.Items.Clear();
Funs.FineUIPleaseSelect(this.drpUnit);
this.drpUnit.SelectedIndex = 0;
}
else
{
this.drpItem.Items.Clear();
Funs.FineUIPleaseSelect(this.drpItem);
this.drpItem.SelectedIndex = 0;
this.drpUnit.Items.Clear();
Funs.FineUIPleaseSelect(this.drpUnit);
this.drpUnit.SelectedIndex = 0;
}
}
protected void drpItem_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.drpItem.SelectedValue != BLL.Const._Null)
{
TestRunPerformanceStandardService.InitUnitDropDownList(drpUnit, this.drpType.SelectedValue,this.drpItem.SelectedValue, true);
this.drpUnit.SelectedIndex = 0;
}
else
{
this.drpUnit.Items.Clear();
Funs.FineUIPleaseSelect(this.drpUnit);
this.drpUnit.SelectedIndex = 0;
}
}
protected void drpUnit_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.drpUnit.SelectedValue != BLL.Const._Null)
{
Model.Base_TestRunPerformanceStandard standard = BLL.TestRunPerformanceStandardService.GetPerformanceStandardById(this.drpUnit.SelectedValue);
if (standard != null)
{
if (standard.Days != null)
{
this.txtDays.Text = standard.Days.ToString();
if (standard.Days > 0)
{
this.txtDays.Readonly = true;
}
else
{
this.txtDays.Readonly = false;
}
}
}
}
else
{
this.txtDays.Text = string.Empty;
this.txtDays.Readonly = true;
}
}
}
}
@@ -0,0 +1,141 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.Personal {
public partial class TestRunPerformanceEdit {
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// SimpleForm1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// txtMonths 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtMonths;
/// <summary>
/// lbUserName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label lbUserName;
/// <summary>
/// drpProject 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpProject;
/// <summary>
/// txtJobContent 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextArea txtJobContent;
/// <summary>
/// drpType 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpType;
/// <summary>
/// drpItem 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpItem;
/// <summary>
/// drpUnit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpUnit;
/// <summary>
/// txtDays 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.NumberBox txtDays;
/// <summary>
/// Toolbar1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// btnSave 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSave;
/// <summary>
/// btnClose 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnClose;
}
}