protected bool InsertFlag = false; //新增 #endregion protected void Page_Load(object sender, EventArgs e) { int TrainPlanID = Utils.GetInt(Request.QueryString["TrainPlanID"], -1); string method = Utils.GetQueryStringValue("method"); PageIndex = Utils.GetInt(Request.QueryString["Page"], 1); if (!IsPostBack && method == "") { if (!CheckGrant(global::Common.Enum.TravelPermission.行政中心_培训计划_栏目)) { Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.行政中心_培训计划_栏目, true); } if (CheckGrant(global::Common.Enum.TravelPermission.行政中心_培训计划_新增计划)) { InsertFlag = true; } if (CheckGrant(global::Common.Enum.TravelPermission.行政中心_培训计划_修改计划)) { EditFlag = true; } if (CheckGrant(global::Common.Enum.TravelPermission.行政中心_培训计划_删除计划)) { DeleteFlag = true; } BindData(); } if (method == "DeleteTrainPlan" && TrainPlanID != -1) //删除 { if (!CheckGrant(global::Common.Enum.TravelPermission.行政中心_培训计划_删除计划)) { Response.Clear(); Response.Write("NoPermission"); Response.End(); } else { EyouSoft.BLL.AdminCenterStructure.TrainPlan bllTrainPlan = new EyouSoft.BLL.AdminCenterStructure.TrainPlan(); if (bllTrainPlan.Delete(CurrentUserCompanyID, TrainPlanID)) { Response.Clear(); Response.Write("True"); Response.End(); } else { Response.Clear(); Response.Write("False"); Response.End(); } } } }
/// <summary> /// 绑定数据 /// </summary> private void BindData() { EyouSoft.BLL.AdminCenterStructure.TrainPlan bllTrainPlan = new EyouSoft.BLL.AdminCenterStructure.TrainPlan(); IList <EyouSoft.Model.AdminCenterStructure.TrainPlan> listTrainPlan = bllTrainPlan.GetList(PageSize, PageIndex, ref RecordCount, CurrentUserCompanyID, SiteUserInfo.ID, SiteUserInfo.DepartId); if (listTrainPlan != null && listTrainPlan.Count > 0) { this.crptTrainingPlanList.DataSource = listTrainPlan; this.crptTrainingPlanList.DataBind(); this.BindPage(); } else { this.crptTrainingPlanList.EmptyText = "<tr><td colspan=\"6\"><div style=\"text-align:center; margin-top:75px; margin-bottom:75px;\">没有相关的数据!</span></div></td></tr>"; this.ExportPageInfo1.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int TrainPlanID = EyouSoft.Common.Utils.GetInt(Request.QueryString["TrainPlanID"]); EyouSoft.BLL.AdminCenterStructure.TrainPlan bllTrainPlan = new EyouSoft.BLL.AdminCenterStructure.TrainPlan(); EyouSoft.Model.AdminCenterStructure.TrainPlan modelTrainPlan = bllTrainPlan.GetModel(CurrentUserCompanyID, TrainPlanID); if (modelTrainPlan != null) { this.lbl_PlanTitle.Text = modelTrainPlan.PlanTitle; this.lbl_PlanContent.Text = modelTrainPlan.PlanContent; this.lbl_OperatorName.Text = modelTrainPlan.OperatorName; this.lbl_IssueTime.Text = string.Format("{0:yyyy-MM-dd}", modelTrainPlan.IssueTime); this.lbl_AcceptPersonnel.Text = GetAcceptList(modelTrainPlan.AcceptList); } else { MessageBox.ShowAndRedirect(this.Page, "没有该数据!", "/administrativeCenter/trainingPlan/Default.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { int TrainPlanID = Utils.GetInt(Request.QueryString["TrainPlanID"], -1); string Method = Utils.GetFormValue("hidMethod"); this.selectDepartment1.SetPicture = "/images/sanping_04.gif"; Publisher = this.SiteUserInfo.UserName; //默认当前帐号,可以修改 PublishTime = DateTime.Now; //默认当前时间 if (!IsPostBack && TrainPlanID != -1) //初始化 { EyouSoft.BLL.AdminCenterStructure.TrainPlan bllTrainPlan = new EyouSoft.BLL.AdminCenterStructure.TrainPlan(); EyouSoft.Model.AdminCenterStructure.TrainPlan modelTrainPlan = bllTrainPlan.GetModel(CurrentUserCompanyID, TrainPlanID); if (modelTrainPlan != null) { this.hidTrainPlanID.Value = modelTrainPlan.Id.ToString(); PlanTitle = modelTrainPlan.PlanTitle; PlanContent = modelTrainPlan.PlanContent; AcceptListInit(modelTrainPlan.AcceptList); Publisher = modelTrainPlan.OperatorName; PublishTime = modelTrainPlan.IssueTime; } else { MessageBox.ShowAndRedirect(this.Page, "没有该条数据", "/administrativeCenter/trainingPlan/Default.aspx"); } } if (Method == "save") { if (TrainPlanID == -1) { if (!CheckGrant(global::Common.Enum.TravelPermission.行政中心_培训计划_新增计划)) { Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.行政中心_培训计划_新增计划, true); } } else { if (!CheckGrant(global::Common.Enum.TravelPermission.行政中心_培训计划_修改计划)) { Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.行政中心_培训计划_修改计划, true); } } EyouSoft.BLL.AdminCenterStructure.TrainPlan bllTrainPlan = new EyouSoft.BLL.AdminCenterStructure.TrainPlan(); EyouSoft.Model.AdminCenterStructure.TrainPlan ModelTrainPlan = new EyouSoft.Model.AdminCenterStructure.TrainPlan(); ModelTrainPlan.CompanyId = CurrentUserCompanyID; ModelTrainPlan.PlanTitle = Utils.GetFormValue("txt_PlanTitle"); ModelTrainPlan.PlanContent = Utils.EditInputText(Request.Form["txt_PlanContent"]); ModelTrainPlan.AcceptList = this.GetListTrainPlanAccepts(); ModelTrainPlan.IssueTime = Utils.GetDateTimeNullable(Request.Form["txt_PublishTime"]); ModelTrainPlan.OperatorName = Utils.GetFormValue("txt_Publisher"); if (ModelTrainPlan.OperatorName == this.SiteUserInfo.UserName) { ModelTrainPlan.OperatorId = this.SiteUserInfo.ID; } if (TrainPlanID == -1) //添加 { if (bllTrainPlan.Add(ModelTrainPlan)) { MessageBox.ResponseScript(this, string.Format("alert('{0}');window.parent.Boxy.getIframeDialog('{1}').hide();window.parent.location='{2}';", "保存成功!", Utils.GetQueryStringValue("iframeId"), "/administrativeCenter/trainingPlan/Default.aspx")); } else { MessageBox.Show(this.Page, "保存失败!"); } } if (TrainPlanID != -1) //修改 { ModelTrainPlan.Id = TrainPlanID; if (bllTrainPlan.Update(ModelTrainPlan)) { MessageBox.ResponseScript(this, string.Format("alert('{0}');window.parent.Boxy.getIframeDialog('{1}').hide();window.parent.location='{2}';", "修改成功!", Utils.GetQueryStringValue("iframeId"), "/administrativeCenter/trainingPlan/Default.aspx")); } else { MessageBox.Show(this.Page, "修改失败!"); } } } }