using BLL; <<<<<<< HEAD using Microsoft.Office.Interop.Excel; using System; using System.Web; ======= using System; >>>>>>> 7396d1b654f9a1d0172b2ac898a20175abe94d74 namespace FineUIPro.Web.HSSE.PostTraining { public partial class StandardEdit : PageBase { #region 定义项 /// /// 主键 /// public string Id { get { return (string)ViewState["Id"]; } set { ViewState["Id"] = value; } } ///// ///// 项目主键 ///// //public string ProjectId //{ // get // { // return (string)ViewState["ProjectId"]; // } // set // { // ViewState["ProjectId"] = value; // } //} #endregion #region 加载 /// /// 加载页面 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //this.ProjectId = this.CurrUser.LoginProjectId; this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); this.InitDropDownList(); this.Id = Request.Params["Id"]; if (!string.IsNullOrEmpty(this.Id)) { Model.PostTraining_Standard model = BLL.PostTrainingStandardService.GetStandardById(this.Id); if (model != null) { this.txtCode.Text = model.Code; this.txtClassHour.Text = model.ClassHour.ToString(); this.txtCycle.Text = model.Cycle.ToString(); this.txtRemark.Text = model.Remark; //if (!string.IsNullOrWhiteSpace(model.RoleId)) //{ // this.drpRole.SelectedValue = model.RoleId; //} if (!string.IsNullOrWhiteSpace(model.WorkPostId)) { this.drpWorkPost.SelectedValue = model.WorkPostId; } if (!string.IsNullOrWhiteSpace(model.CourseId)) { var course = BLL.PostTrainingCourseService.GetCourseById(model.CourseId); this.drpCategory.SelectedValue = course.CategoryId; //培训课程 PostTrainingCourseService.InitPostTrainingCourseDropDownList(this.drpCourse, course.CategoryId, false); this.drpCourse.SelectedValue = model.CourseId; } if (!string.IsNullOrWhiteSpace(model.Method)) { this.drpMethod.SelectedValue = model.Method; } if (!string.IsNullOrWhiteSpace(model.Teachers)) { this.drpTeachers.SelectedValue = model.Teachers; } if (!string.IsNullOrWhiteSpace(model.Outcome)) { this.drpOutcome.SelectedValue = model.Outcome; } } } else { ////自动生成编码 //this.txtCode.Text = SQLHelper.RunProcNewId2("SpGetNewCode3ByProjectId", "dbo.PostTraining_Standard", "Code", CurrUser.LoginProjectId); this.txtCode.Text = SQLHelper.RunProcNewId("SpGetNewCode5", "dbo.PostTraining_Standard", "Code", ""); } } } /// /// 下拉框加载 /// private void InitDropDownList() { //所属岗位 WorkPostService.InitWorkPostDropDownList(this.drpWorkPost, true); ////获取适用岗位下拉框 //PostTrainingRoleService.InitPostTrainingRoleDropDownList(this.drpRole, false); //获取培训类别下拉框 PostTrainingCategoryService.InitPostTrainingCategoryDropDownList(this.drpCategory, false); //获取培训方式下拉框 PostTrainingMethodService.InitPostTrainingMethodDropDownList(this.drpMethod, null, false); //获取培训师资下拉框 PostTrainingTeachersService.InitPostTrainingTeachersDropDownList(this.drpTeachers, null, false); //培训效果 PostTrainingStandardService.InitPostTrainingOutcomeDropDownList(this.drpOutcome, false); } /// /// 培训类别下拉加载 /// /// /// protected void drpCategory_SelectedIndexChanged(object sender, EventArgs e) { //培训课程 PostTrainingCourseService.InitPostTrainingCourseDropDownList(this.drpCourse, this.drpCategory.SelectedValue, false); } #endregion #region 保存 /// /// 保存按钮 /// /// /// protected void btnSave_Click(object sender, EventArgs e) { this.SaveData(BLL.Const.BtnSave); PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); } /// /// 保存数据 /// /// private void SaveData(string type) { Model.PostTraining_Standard newModel = new Model.PostTraining_Standard { //ProjectId = this.ProjectId, Code = this.txtCode.Text.Trim(), CompileDate = DateTime.Now, CompileMan = this.CurrUser.UserId }; newModel.WorkPostId = this.drpWorkPost.SelectedValue; //newModel.RoleId = this.drpRole.SelectedValue; newModel.CourseId = this.drpCourse.SelectedValue; newModel.ClassHour = decimal.Parse(this.txtClassHour.Text.Trim()); <<<<<<< HEAD newModel.Cycle = int.Parse(this.txtCycle.Text.Trim()); ======= newModel.Cycle = decimal.Parse(this.txtCycle.Text.Trim()); >>>>>>> 7396d1b654f9a1d0172b2ac898a20175abe94d74 newModel.Method = this.drpMethod.SelectedText; newModel.Outcome = this.drpOutcome.SelectedText; newModel.Teachers = this.drpTeachers.SelectedText; newModel.Remark = this.txtRemark.Text.Trim(); if (!string.IsNullOrEmpty(this.Id)) { newModel.Id = this.Id; BLL.PostTrainingStandardService.UpdateStandard(newModel); BLL.LogService.AddSys_Log(this.CurrUser, newModel.Code, newModel.Id, BLL.Const.PostTrainingStandardMenuId, BLL.Const.BtnModify); } else { this.Id = SQLHelper.GetNewID(typeof(Model.PostTraining_Standard)); newModel.Id = this.Id; BLL.PostTrainingStandardService.AddStandard(newModel); BLL.LogService.AddSys_Log(this.CurrUser, newModel.Code, newModel.Id, BLL.Const.PostTrainingStandardMenuId, BLL.Const.BtnAdd); } } #endregion #region 附件上传 ///// ///// 上传附件 ///// ///// ///// //protected void btnAttachUrl_Click(object sender, EventArgs e) //{ // if (string.IsNullOrEmpty(this.Id)) // { // SaveData(BLL.Const.BtnSave); // } // PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/PostTraining/Standard&menuId={1}", Id, BLL.Const.PostTrainingStandardMenuId))); //} #endregion } }