140 lines
5.2 KiB
C#
140 lines
5.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using BLL;
|
|
|
|
namespace FineUIPro.Web.JDGL.WBS
|
|
{
|
|
public partial class MilePostEdit : PageBase
|
|
{
|
|
#region 定义变量
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
public string MilePostId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["MilePostId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["MilePostId"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 加载
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.drpCNProfessionalId.DataValueField = "CnProfessionId";
|
|
this.drpCNProfessionalId.DataTextField = "CnProfessionName";
|
|
this.drpCNProfessionalId.DataSource = BLL.CnProfessionInitService.GetCnProfessionInitDropDownList();
|
|
this.drpCNProfessionalId.DataBind();
|
|
Funs.FineUIPleaseSelect(drpCNProfessionalId);
|
|
this.MilePostId = Request.Params["MilePostId"];
|
|
Model.WBS_MilePost milePost = BLL.MilePostService.GetMilePostById(this.MilePostId);
|
|
if (milePost != null)
|
|
{
|
|
this.MilePostId = milePost.MilePostId;
|
|
this.hdAttachUrl.Text = this.MilePostId;
|
|
if (milePost.CnProfessionId != null)
|
|
{
|
|
this.drpCNProfessionalId.SelectedValue = milePost.CnProfessionId.ToString();
|
|
}
|
|
this.txtMilePostName.Text = milePost.MilePostName;
|
|
if (milePost.PlanDate != null)
|
|
{
|
|
this.txtPlanDate.Text = string.Format("{0:yyyy-MM-dd}", milePost.PlanDate);
|
|
}
|
|
if (milePost.RealDate != null)
|
|
{
|
|
this.txtRealDate.Text = string.Format("{0:yyyy-MM-dd}", milePost.RealDate);
|
|
}
|
|
this.txtRemark.Text = milePost.Remark;
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 保存
|
|
/// <summary>
|
|
/// 保存按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
if (drpCNProfessionalId.SelectedValue == BLL.Const._Null)
|
|
{
|
|
Alert.ShowInTop("请选择专业!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
Model.WBS_MilePost milePost = new Model.WBS_MilePost();
|
|
milePost.ProjectId = this.CurrUser.LoginProjectId;
|
|
if (this.drpCNProfessionalId.SelectedValue != BLL.Const._Null)
|
|
{
|
|
milePost.CnProfessionId = Funs.GetNewInt(this.drpCNProfessionalId.SelectedValue);
|
|
}
|
|
milePost.MilePostName = this.txtMilePostName.Text.Trim();
|
|
if (!string.IsNullOrEmpty(this.txtPlanDate.Text))
|
|
{
|
|
milePost.PlanDate = Convert.ToDateTime(this.txtPlanDate.Text);
|
|
}
|
|
if (!string.IsNullOrEmpty(this.txtRealDate.Text))
|
|
{
|
|
milePost.RealDate = Convert.ToDateTime(this.txtRealDate.Text);
|
|
}
|
|
milePost.Remark = this.txtRemark.Text.Trim();
|
|
if (string.IsNullOrEmpty(this.MilePostId))
|
|
{
|
|
if (!string.IsNullOrEmpty(this.hdAttachUrl.Text))
|
|
{
|
|
milePost.MilePostId = this.hdAttachUrl.Text;
|
|
}
|
|
else
|
|
{
|
|
milePost.MilePostId = SQLHelper.GetNewID(typeof(Model.WBS_MilePost));
|
|
this.hdAttachUrl.Text = milePost.MilePostId;
|
|
}
|
|
milePost.CompileMan = this.CurrUser.UserId;
|
|
milePost.CompileDate = DateTime.Now;
|
|
BLL.MilePostService.AddMilePost(milePost);
|
|
}
|
|
else
|
|
{
|
|
milePost.MilePostId = this.MilePostId;
|
|
BLL.MilePostService.UpdateMilePost(milePost);
|
|
}
|
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
#endregion
|
|
|
|
#region 附件上传
|
|
/// <summary>
|
|
/// 附件上传
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnAttach_Click(object sender, EventArgs e)
|
|
{
|
|
if (string.IsNullOrEmpty(this.hdAttachUrl.Text)) //新增记录
|
|
{
|
|
this.hdAttachUrl.Text = SQLHelper.GetNewID(typeof(Model.WBS_MilePost));
|
|
}
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/JDGL/MilePost&menuId={1}", this.hdAttachUrl.Text, BLL.Const.MilePostMenuId)));
|
|
}
|
|
#endregion
|
|
}
|
|
} |