示例#1
0
 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");
         }
     }
 }
示例#2
0
        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, "修改失败!");
                    }
                }
            }
        }