104 lines
3.1 KiB
C#
104 lines
3.1 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace FineUIPro.Web.SYHSE
|
|
{
|
|
public partial class Data_BaseEdit : PageBase
|
|
{
|
|
#region 公共字段
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
public string Id
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["Id"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["Id"] = value;
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
/// <summary>
|
|
/// 把状态转换代号为文字形式
|
|
/// </summary>
|
|
/// <param name="state"></param>
|
|
/// <returns></returns>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
Id = Request.Params["Id"];
|
|
|
|
if (!string.IsNullOrEmpty(Id))
|
|
{
|
|
|
|
var Base = Funs.DB.SYHSEData_Base.FirstOrDefault(x => x.Id == Id);
|
|
if (Base != null)
|
|
{
|
|
if (Base.ReportDate.HasValue)
|
|
{
|
|
this.txtReportDate.Text = Base.ReportDate.Value.ToString("yyyy-MM-dd");
|
|
}
|
|
if (Base.SafeWorkinghours.HasValue)
|
|
{
|
|
this.txtSafeWorkinghours.Text = Base.SafeWorkinghours.Value.ToString();
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
//string projectId, string userId, string menuId, string buttonName)
|
|
if (BLL.CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.SYHSE_BaseMenuId, BLL.Const.BtnSave))
|
|
{
|
|
Model.SYHSEData_Base data_Base = Funs.DB.SYHSEData_Base.FirstOrDefault(x => x.Id == Id);
|
|
if (data_Base == null)
|
|
{
|
|
data_Base = new Model.SYHSEData_Base();
|
|
data_Base.Id = Guid.NewGuid().ToString();
|
|
Funs.DB.SYHSEData_Base.InsertOnSubmit(data_Base);
|
|
}
|
|
data_Base.ProjectId = this.CurrUser.LoginProjectId;
|
|
data_Base.UnitId = this.CurrUser.UserId;
|
|
data_Base.CreateMan = this.CurrUser.UserId;
|
|
data_Base.CreateDate = DateTime.Now;
|
|
if (!string.IsNullOrEmpty(this.txtSafeWorkinghours.Text))
|
|
{
|
|
data_Base.SafeWorkinghours = int.Parse(this.txtSafeWorkinghours.Text);
|
|
}
|
|
data_Base.ReportDate = this.txtReportDate.SelectedDate;
|
|
Funs.DB.SubmitChanges();
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
} |