SGGL_HBAZ/SGGL/FineUIPro.Web/CQMS/QuantityManagement/BaseView.aspx.cs

184 lines
6.1 KiB
C#

using BLL;
using System;
using System.Collections.Generic;
using System.Linq;
namespace FineUIPro.Web.CQMS.QuantityManagement
{
public partial class BaseView : PageBase
{
#region
/// <summary>
/// 主键
/// </summary>
public string BaseId
{
get
{
return (string)ViewState["BaseId"];
}
set
{
ViewState["BaseId"] = value;
}
}
/// <summary>
/// 办理类型
/// </summary>
public string State
{
get
{
return (string)ViewState["State"];
}
set
{
ViewState["State"] = value;
}
}
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GetButtonPower();
this.BaseId = Request.Params["BaseId"];
plApprove2.Hidden = true;
BLL.DrawingService.InitDrawingChangeDropDownList(drpDrawingNo, this.CurrUser.LoginProjectId, true);
BLL.TeamGroupService.InitTeamGroupProjectDropDownList(drpWorkTeam, this.CurrUser.LoginProjectId, true);
var Base = BLL.BaseService.GetBaseById(this.BaseId);
if (Base != null)
{
Model.QuantityManagement_Drawing drawing = BLL.DrawingService.GetDrawingById(Base.DrawingId);
Model.QuantityManagement_Change change = BLL.ChangeService.GetChangeById(Base.DrawingId);
this.BaseId = Base.BaseId;
plApprove2.Hidden = false;
var dt = BaseApproveService.getListData(BaseId);
gvApprove.DataSource = dt;
gvApprove.DataBind();
if (drawing != null)
{
this.txtWorkSection.Text = drawing.WorkSection;
this.drpDrawingNo.SelectedValue = Base.DrawingId;
this.txtDrawingName.Text = drawing.DrawingName;
}
else if (change != null)
{
this.txtWorkSection.Text = change.WorkSection;
this.drpDrawingNo.SelectedValue = Base.DrawingId;
this.txtDrawingName.Text = change.ChangeName;
}
this.txtPart.Text = Base.Part;
this.txtProjectContent.Text = Base.ProjectContent;
this.txtUnit.Text = Base.Unit;
if (Base.Amount != null)
{
this.txtAmount.Text = Base.Amount.ToString();
}
if (!string.IsNullOrEmpty(Base.WorkTeam))
{
this.drpWorkTeam.SelectedValue = Base.WorkTeam;
}
if (!string.IsNullOrEmpty(Base.State))
{
State = Base.State;
}
else
{
State = BLL.Const.Base_Compile;
}
}
else
{
State = Const.Base_Compile;
}
}
}
#endregion
protected void drpDrawingNo_SelectedIndexChanged(object sender, EventArgs e)
{
Model.QuantityManagement_Drawing drawing = BLL.DrawingService.GetDrawingById(this.drpDrawingNo.SelectedValue);
Model.QuantityManagement_Change change = BLL.ChangeService.GetChangeById(this.drpDrawingNo.SelectedValue);
if (drawing != null)
{
this.txtWorkSection.Text = drawing.WorkSection;
this.txtDrawingName.Text = drawing.DrawingName;
this.txtAmount.NoNegative = true;
}
else if (change != null)
{
this.txtWorkSection.Text = change.WorkSection;
this.txtDrawingName.Text = change.ChangeName;
this.txtAmount.NoNegative = false;
}
else
{
this.txtWorkSection.Text = string.Empty;
this.txtDrawingName.Text = string.Empty;
this.txtAmount.NoNegative = true;
}
}
#region
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="button"></param>
/// <returns></returns>
private void GetButtonPower()
{
if (Request.Params["value"] == "0")
{
return;
}
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.BaseMenuId);
if (buttonList.Count() > 0)
{
}
}
#endregion
/// <summary>
/// 把状态转换代号为文字形式
/// </summary>
/// <param name="state"></param>
/// <returns></returns>
protected string ConvertState(object state)
{
if (state != null)
{
if (state.ToString() == BLL.Const.Base_ReCompile)
{
return "重新编制";
}
else if (state.ToString() == BLL.Const.Base_Compile)
{
return "编制";
}
else if (state.ToString() == BLL.Const.Base_Audit1)
{
return "审核";
}
else if (state.ToString() == BLL.Const.Base_Complete)
{
return "审批完成";
}
else
{
return "";
}
}
return "";
}
}
}