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.Train { public partial class TrainRecordView : PageBase { /// /// 主键 /// public string TrainPlanId { get { return (string)ViewState["TrainPlanId"]; } set { ViewState["TrainPlanId"] = value; } } /// /// 办理类型 /// public string State { get { return (string)ViewState["State"]; } set { ViewState["State"] = value; } } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { TrainPlanId = Request.Params["TrainPlanId"]; BLL.CQMSTrainObjectService.InitTrainObjectDropDownList(this.drpPlanTrainPersons, true); BLL.SitePerson_PersonService.InitProjectUserListByProjectUnitTypeDropDownList(this.drpRealTrainPersons, this.CurrUser.LoginProjectId, Const.ProjectUnitType_1 + "," + Const.ProjectUnitType_2, true); BLL.SitePerson_PersonService.InitSitePersonByUnitTypeRoletIdsDropDownList(this.drpHostMan, this.CurrUser.LoginProjectId, Const.ProjectUnitType_1, Const.QAManager + "," + Const.CQEngineer, true); BLL.CQMSTrainTypeService.InitTrainTypeDropDownList(this.drpTrainType, true); if (!string.IsNullOrEmpty(TrainPlanId)) { Model.Train_TrainPlan TrainPlan = BLL.CQMS_TrainPlanService.GetTrainPlanByTrainPlanId(TrainPlanId); hdId.Text = TrainPlanId; if (!string.IsNullOrEmpty(TrainPlan.PlanTrainPersons)) { this.drpPlanTrainPersons.SelectedValueArray = TrainPlan.PlanTrainPersons.Split(','); } if (TrainPlan.PlanTrainDate != null) { txtPlanTrainDate.Text = string.Format("{0:yyyy-MM-dd}", TrainPlan.PlanTrainDate); } if (!string.IsNullOrEmpty(TrainPlan.TrainTypeId)) { this.drpTrainType.SelectedValue = TrainPlan.TrainTypeId; } if (!string.IsNullOrEmpty(TrainPlan.HostMan)) { this.drpHostMan.SelectedValueArray = TrainPlan.HostMan.Split(','); } this.txtPlace.Text = TrainPlan.Place; if (TrainPlan.RealTrainDate != null) { txtRealTrainDate.Text = string.Format("{0:yyyy-MM-dd}", TrainPlan.RealTrainDate); } if (TrainPlan.TeachHour != null) { txtTeachHour.Text = TrainPlan.TeachHour.ToString(); } if (TrainPlan.TrainPersonNum != null) { txtTrainPersonNum.Text = TrainPlan.TrainPersonNum.ToString(); } if (!string.IsNullOrEmpty(TrainPlan.RealTrainPersons)) { this.drpRealTrainPersons.SelectedValueArray = TrainPlan.RealTrainPersons.Split(','); } this.txtTrainContent.Text = TrainPlan.TrainContent; } } } protected void Grid1_Sort(object sender, GridSortEventArgs e) { } protected void WindowAtt_Close(object sender, WindowCloseEventArgs e) { } /// /// 时间转换 /// /// /// public string ConvertDate(object date) { if (date != null) { return string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(date)); } else { return null; } } protected void drpRealTrainPersons_SelectedIndexChanged(object sender, EventArgs e) { int i = 0; foreach (var item in this.drpRealTrainPersons.SelectedValueArray) { if (item != Const._Null) { i++; } } this.txtTrainPersonNum.Text = i.ToString(); } 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/Train&menuId={1}", hdId.Text, BLL.Const.CQMSTrainPlanMenuId))); } } }