提交代码
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user