Esempio n. 1
0
 /// <summary>
 /// 页面初始化
 /// </summary>
 /// <param name="id">操作ID</param>
 protected void PageInit(string id)
 {
     #region 用户控件初始化
     this.SingleFileUpload1.CompanyID = this.SiteUserInfo.CompanyId;
     this.SingleFileUpload2.CompanyID = this.SiteUserInfo.CompanyId;
     this.SingleFileUpload3.CompanyID = this.SiteUserInfo.CompanyId;
     #endregion
     //编辑初始化
     if (!string.IsNullOrEmpty(id))
     {
         BTrain    BLL   = new BTrain();
         MGovTrain Model = BLL.GetGovTrainModel(id);
         if (null != Model)
         {
             this.hidKeyId.Value   = Model.TrainId;
             this.txtSTime.Text    = Model.StateTime.HasValue ? Model.StateTime.Value.ToString("yyyy-MM-dd HH:mm") : "";
             this.txtETime.Text    = Model.EndTime.HasValue ? Model.EndTime.Value.ToString("yyyy-MM-dd HH:mm") : "";
             this.txtTheme.Text    = Model.Title;
             this.txtJoinpeo.Text  = Model.JoinPeople;
             this.txtPlace.Text    = Model.TrainingLocations;
             this.txtTrainpeo.Text = Model.TrainPeople;
             this.txtTraincon.Text = Model.Training;
             NewGetLableText(Model.ComAttachList);
             if (!this.SiteUserInfo.IsHandleElse && this.SiteUserInfo.UserId != Model.OperatorId)
             {
                 this.ph_Save.Visible = false;
             }
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        /// ajax操作
        /// </summary>
        private void AJAX(string doType)
        {
            string msg    = string.Empty;
            bool   result = false;
            string id     = Utils.GetQueryStringValue("id");
            //执行并获取结果
            BTrain BLL = new BTrain();

            result = BLL.DeleteGovTrain(id.Split(','));
            msg    = result ? "删除成功!" : "删除失败!";
            //返回ajax操作结果
            Response.Clear();
            Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg));
            Response.End();
        }
Esempio n. 3
0
 /// <summary>
 /// 保存按钮点击事件执行方法
 /// </summary>
 protected void PageSave(string doType)
 {
     #region 表单取值
     string trainid     = Utils.GetFormValue(hidKeyId.UniqueID);
     string starttime   = Utils.GetFormValue(txtSTime.UniqueID);
     string endtime     = Utils.GetFormValue(txtETime.UniqueID);
     string title       = Utils.GetFormValue(txtTheme.UniqueID);
     string joinpeople  = Utils.GetFormValue(txtJoinpeo.UniqueID);
     string trainpeople = Utils.GetFormValue(txtJoinpeo.UniqueID);
     string train       = Utils.GetFormValue(txtTraincon.UniqueID);
     string place       = Utils.GetFormValue(txtPlace.UniqueID);
     #endregion
     #region 表单验证
     string msg    = "";
     bool   result = false;
     if (string.IsNullOrEmpty(starttime))
     {
         msg += "-请输入培训开始时间!";
     }
     if (string.IsNullOrEmpty(endtime))
     {
         msg += "-请输入培训结束时间!";
     }
     if (string.IsNullOrEmpty(title))
     {
         msg += "-请输入培训主题!";
     }
     if (string.IsNullOrEmpty(joinpeople))
     {
         msg += "-请输入培训参与人员!";
     }
     if (string.IsNullOrEmpty(trainpeople))
     {
         msg += "-请输入培训人员!";
     }
     if (string.IsNullOrEmpty(place))
     {
         msg += "-请输入培训地点!";
     }
     if (!string.IsNullOrEmpty(msg))
     {
         Response.Clear();
         Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg));
         Response.End();
     }
     #endregion
     #region 实体赋值
     MGovTrain Model = new MGovTrain();
     Model.CompanyId         = this.SiteUserInfo.CompanyId;
     Model.DepartId          = this.SiteUserInfo.DeptId;
     Model.EndTime           = Utils.GetDateTimeNullable(endtime);
     Model.IssueTime         = DateTime.Now;
     Model.JoinPeople        = joinpeople;
     Model.OperatorId        = this.SiteUserInfo.UserId;
     Model.StateTime         = Utils.GetDateTimeNullable(starttime);
     Model.Title             = title;
     Model.TrainId           = trainid;
     Model.Training          = train;
     Model.TrainingLocations = place;
     Model.TrainPeople       = trainpeople;
     Model.ComAttachList     = NewGetAttach();
     #endregion
     #region 保存提交
     BTrain BLL = new BTrain();
     if (doType == "add")
     {
         result = BLL.AddGovTrain(Model);
         msg    = result ? "添加成功!" : "添加失败!";
     }
     else
     {
         result = BLL.UpdateGovTrain(Model);
         msg    = result ? "修改成功!" : "修改失败!";
     }
     Response.Clear();
     Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg));
     Response.End();
     #endregion
 }