SGGL_SHJ/SGGL/FineUIPro.Web/CQMS/Meeting/SpecialMeetingView.aspx.cs

199 lines
7.1 KiB
C#

using BLL;
using Newtonsoft.Json.Linq;
using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Linq;
using System.Web.UI.WebControls;
using AspNet = System.Web.UI.WebControls;
namespace FineUIPro.Web.CQMS.Meeting
{
public partial class SpecialMeetingView : PageBase
{
/// <summary>
/// 主键
/// </summary>
public string MeetingId
{
get
{
return (string)ViewState["MeetingId"];
}
set
{
ViewState["MeetingId"] = value;
}
}
/// <summary>
/// 办理类型
/// </summary>
public string State
{
get
{
return (string)ViewState["State"];
}
set
{
ViewState["State"] = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
MeetingId = Request.Params["MeetingId"];
BLL.UnitService.GetUnit(this.drpUnit, this.CurrUser.LoginProjectId, true);
BLL.SitePerson_PersonService.InitProjectUserListByProjectUnitTypeDropDownList(this.drpAttentPerson, this.CurrUser.LoginProjectId, Const.ProjectUnitType_1 + "," + Const.ProjectUnitType_2, true);
if (!string.IsNullOrEmpty(MeetingId))
{
Model.Meeting_CQMSMeeting CQMSMeeting = BLL.CQMS_MeetingService.GetCQMSMeetingById(MeetingId);
hdId.Text = this.MeetingId;
if (!string.IsNullOrEmpty(CQMSMeeting.UnitId))
{
this.drpUnit.SelectedValue = CQMSMeeting.UnitId;
BindHostMan();
if (!string.IsNullOrEmpty(CQMSMeeting.HostMan))
{
this.drpHostMan.SelectedValueArray = CQMSMeeting.HostMan.Split(',');
}
}
txtMeetingCode.Text = CQMSMeeting.MeetingCode;
if (CQMSMeeting.MeetingDate != null)
{
this.txtMeetingDate.Text = string.Format("{0:yyyy-MM-dd}", CQMSMeeting.MeetingDate);
}
txtPlace.Text = CQMSMeeting.Place;
if (!string.IsNullOrEmpty(CQMSMeeting.AttentPerson))
{
this.drpAttentPerson.SelectedValueArray = CQMSMeeting.AttentPerson.Split(',');
}
this.txtMeetingTheme.Text = CQMSMeeting.MeetingTheme;
this.txtMeetingContents.Text = CQMSMeeting.MeetingContents;
gvApprove.DataSource = BLL.CQMS_MeetingApproveService.getListData(this.MeetingId);
gvApprove.DataBind();
if (!string.IsNullOrEmpty(Request.Params["see"]))
{
Model.Meeting_CQMSMeetingApprove approve = BLL.CQMS_MeetingApproveService.GetSee(MeetingId, this.CurrUser.PersonId);
if (approve != null)
{
approve.ApproveDate = DateTime.Now;
BLL.CQMS_MeetingApproveService.UpdateCQMSMeetingApprove(approve);
}
}
}
}
}
private void BindHostMan()
{
if (this.drpUnit.SelectedValue != BLL.Const._Null)
{
this.drpHostMan.DataTextField = "PersonName";
this.drpHostMan.DataValueField = "PersonId";
this.drpHostMan.DataSource = BLL.SitePerson_PersonService.GetSitePerson_PersonListByUnitIdsRoleIds(this.CurrUser.LoginProjectId, this.drpUnit.SelectedValue, null);
this.drpHostMan.DataBind();
Funs.FineUIPleaseSelect(this.drpHostMan);
this.drpHostMan.SelectedValue = BLL.Const._Null;
string prefix = BLL.ProjectService.GetProjectCodeByProjectId(this.CurrUser.LoginProjectId) + "-" + BLL.UnitService.GetUnitCodeByUnitId(this.drpUnit.SelectedValue) + "-ZLYLH-";
txtMeetingCode.Text = BLL.SQLHelper.RunProcNewId("SpGetThreeNumber", "Meeting_CQMSMeeting", "MeetingCode", this.CurrUser.LoginProjectId, prefix);
}
else
{
this.drpHostMan.Items.Clear();
Funs.FineUIPleaseSelect(this.drpHostMan);
txtMeetingCode.Text = string.Empty;
}
}
protected void Grid1_Sort(object sender, GridSortEventArgs e)
{
}
protected void WindowAtt_Close(object sender, WindowCloseEventArgs e)
{
}
/// <summary>
/// 时间转换
/// </summary>
/// <param name="date"></param>
/// <returns></returns>
public string ConvertDate(object date)
{
if (date != null)
{
return string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(date));
}
else
{
return null;
}
}
/// <summary>
/// 把状态转换代号为文字形式
/// </summary>
/// <param name="state"></param>
/// <returns></returns>
protected string ConvertState(object state)
{
if (state != null)
{
if (state.ToString() == BLL.Const.CQMSMeeting_ReCompile)
{
return "重新编制";
}
else if (state.ToString() == BLL.Const.CQMSMeeting_Compile)
{
return "编制";
}
else if (state.ToString() == BLL.Const.CQMSMeeting_Audit)
{
return "总包质量经理审批";
}
else if (state.ToString() == BLL.Const.CQMSMeeting_Complete)
{
return "审批完成";
}
else
{
return "";
}
}
return "";
}
protected void imgBtnFile_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(hdId.Text))
{
hdId.Text = SQLHelper.GetNewID();
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=-1&toKeyId={0}&path=FileUpload/CQMS/Meeting&menuId={1}", hdId.Text, BLL.Const.CQMSSpecialMeetingMenuId)));
}
private string GetStringByArray(string[] array)
{
string str = string.Empty;
foreach (var item in array)
{
if (item != BLL.Const._Null)
{
str += item + ",";
}
}
if (!string.IsNullOrEmpty(str))
{
str = str.Substring(0, str.LastIndexOf(","));
}
return str;
}
}
}