///<summary>
        ///</summary>
        ///<param name="TraineeApplicationID"></param>
        ///<returns></returns>
        public TraineeApplication GetTraineeApplicationByTraineeApplicationID(int TraineeApplicationID)
        {
            TraineeApplication app = new TraineeApplication();
            SqlCommand         cmd = new SqlCommand();

            cmd.Parameters.Add(_PKID, SqlDbType.Int).Value = TraineeApplicationID;
            using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetTrainApplicationByPKID", cmd))
            {
                while (sdr.Read())
                {
                    app.PKID                         = TraineeApplicationID;
                    app.CourseName                   = (sdr[_DBCourseName]).ToString();
                    app.Applicant                    = new Account();
                    app.Applicant.Id                 = Convert.ToInt32(sdr[_DBApplicationId]);
                    app.TrainType                    = TrainScopeType.GetById(Convert.ToInt32(sdr[_DBTrainType]));
                    app.Trainer                      = (sdr[_DBTrainer]).ToString();
                    app.Skills                       = (sdr[_DBSkills]).ToString();
                    app.StratTime                    = Convert.ToDateTime(sdr[_DBStratTime]);
                    app.EndTime                      = Convert.ToDateTime(sdr[_DBEndTime]);
                    app.TrainPlace                   = (sdr[_DBTrianPlace]).ToString();
                    app.TrainOrgnatiaon              = (sdr[_DBTrainOrgnatiaon]).ToString();
                    app.TrainHour                    = Convert.ToInt32(sdr[_DBTrainHour]);
                    app.TrainCost                    = Convert.ToInt32(sdr[_DBTrainCost]);
                    app.EduSpuCost                   = HrmisUtility.ConvertToDecimal(sdr[_DbEduSpuCost]);
                    app.HasCertifacation             = (Convert.ToInt32(sdr[_DBHasCertification])).Equals(1);
                    app.NextStep                     = new DiyStep(Convert.ToInt32(sdr[_DBNextStepIndex]));
                    app.TraineeApplicationStatuss    = TraineeApplicationStatus.FindTraineeApplicationStatus(Convert.ToInt32(sdr[_DBApplicationStatus]));
                    app.TraineeApplicationDiyProcess = DiyProcessDal.ConvertToObject(sdr[_DbDiyProcess].ToString());
                    app.StudentList                  = GetAppTrainee(TraineeApplicationID);
                    app.TraineeApplicationFlowList   = GetApplicationFlows(TraineeApplicationID);
                }
                return(app);
            }
        }
        public void SearchEvent(object sender, EventArgs e)
        {
            if (!Validate())
            {
            }
            else
            {
                try
                {
                    _ItsView.ErrorMessage = string.Empty;

                    int scope  = Convert.ToInt32(_ItsView.Scope);
                    int status = Convert.ToInt32(_ItsView.SelectedStatus);

                    List <TraineeApplication> applications =
                        _ITrainFacade.GetTraineeApplicationByCondition(_ItsView.Trainer, _ItsView.Trainee, _ItsView.CourseName, _OutStartFrom,
                                                                       _OutStartTo, _ItsView.HasCertification,
                                                                       TrainScopeType.GetById(scope),
                                                                       TraineeApplicationStatus.
                                                                       FindTraineeApplicationStatus(status));
                    _ItsView.ApplicationSource = applications;

                    _ItsView.ErrorMessage = "<span class='font14b'>共查到 " + "<span class='fontred'>" + applications.Count +
                                            "</span>" + "<span class='font14b'> 条记录</span>";
                }
                catch (Exception ex)
                {
                    _ItsView.ErrorMessage = "<span class='fontred'>" + ex.Message + "</span>";
                }
            }
        }
        ///<summary>
        ///</summary>
        ///<param name="traineeName"></param>
        ///<param name="courseName"></param>
        ///<param name="traineeFrom"></param>
        ///<param name="traineeTo"></param>
        ///<param name="hasCertifacation"></param>
        ///<param name="trainScopeEnum"></param>
        ///<param name="statusEnum"></param>
        ///<returns></returns>
        public List <TraineeApplication> GetTraineeApplicationByCondition(string traineeName, string courseName, DateTime?traineeFrom, DateTime?traineeTo, int hasCertifacation, TrainScopeType trainScopeEnum, TraineeApplicationStatus statusEnum)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.Parameters.Add(_CourseName, SqlDbType.NVarChar, 200).Value = courseName;
            cmd.Parameters.Add(_Trainer, SqlDbType.NVarChar, 50).Value     = traineeName;
            cmd.Parameters.Add(_StratTime, SqlDbType.DateTime).Value       = traineeFrom;
            cmd.Parameters.Add(_EndTime, SqlDbType.DateTime).Value         = traineeTo;
            cmd.Parameters.Add(_TrainType, SqlDbType.Int).Value            = trainScopeEnum.Id;
            cmd.Parameters.Add(_HasCertification, SqlDbType.Int).Value     = hasCertifacation;
            cmd.Parameters.Add(_ApplicationStatus, SqlDbType.Int).Value    = statusEnum.Id;
            using (
                SqlDataReader sdr =
                    SqlHelper.ExecuteReader("GetTrainApplicationByCondition", cmd))
            {
                List <TraineeApplication> apps = new List <TraineeApplication>();
                while (sdr.Read())
                {
                    TraineeApplication app =
                        new TraineeApplication();
                    app.PKID                      = Convert.ToInt32(sdr[_DBPKID]);
                    app.CourseName                = (sdr[_DBCourseName]).ToString();
                    app.Applicant                 = new Account();
                    app.Applicant.Id              = Convert.ToInt32(sdr[_DBApplicationId]);
                    app.TrainType                 = TrainScopeType.GetById(Convert.ToInt32(sdr[_DBTrainType]));
                    app.Trainer                   = (sdr[_DBTrainer]).ToString();
                    app.Skills                    = (sdr[_DBSkills]).ToString();
                    app.StratTime                 = Convert.ToDateTime(sdr[_DBStratTime]);
                    app.EndTime                   = Convert.ToDateTime(sdr[_DBEndTime]);
                    app.TrainPlace                = (sdr[_DBTrianPlace]).ToString();
                    app.TrainOrgnatiaon           = (sdr[_DBTrainOrgnatiaon]).ToString();
                    app.TrainHour                 = Convert.ToInt32(sdr[_DBTrainHour]);
                    app.TrainCost                 = Convert.ToInt32(sdr[_DBTrainCost]);
                    app.EduSpuCost                = HrmisUtility.ConvertToDecimal(sdr[_DbEduSpuCost]);
                    app.HasCertifacation          = (Convert.ToInt32(sdr[_DBHasCertification])).Equals(1);
                    app.NextStep                  = new DiyStep(Convert.ToInt32(sdr[_DBNextStepIndex]));
                    app.TraineeApplicationStatuss =
                        TraineeApplicationStatus.FindTraineeApplicationStatus(Convert.ToInt32(sdr[_DBApplicationStatus]));
                    app.TraineeApplicationDiyProcess = DiyProcessDal.ConvertToObject(sdr[_DbDiyProcess].ToString());
                    apps.Add(app);
                }
                return(apps);
            }
        }
        /// <summary>
        /// »ñÈ¡´ýÉóºËµÄÅàѵÉêÇë
        /// </summary>
        /// <returns></returns>
        public List <TraineeApplication> GetConfimingTraineeApplications()
        {
            SqlCommand cmd = new SqlCommand();

            using (
                SqlDataReader sdr =
                    SqlHelper.ExecuteReader("GetConfirmingTrainApplication", cmd))
            {
                List <TraineeApplication> apps = new List <TraineeApplication>();
                while (sdr.Read())
                {
                    TraineeApplication app =
                        new TraineeApplication();
                    app.PKID                      = Convert.ToInt32(sdr[_DBPKID]);
                    app.CourseName                = (sdr[_DBCourseName]).ToString();
                    app.Applicant                 = new Account();
                    app.Applicant.Id              = Convert.ToInt32(sdr[_DBApplicationId]);
                    app.TrainType                 = TrainScopeType.GetById(Convert.ToInt32(sdr[_DBTrainType]));
                    app.Trainer                   = (sdr[_DBTrainer]).ToString();
                    app.Skills                    = (sdr[_DBSkills]).ToString();
                    app.StratTime                 = Convert.ToDateTime(sdr[_DBStratTime]);
                    app.EndTime                   = Convert.ToDateTime(sdr[_DBEndTime]);
                    app.TrainPlace                = (sdr[_DBTrianPlace]).ToString();
                    app.TrainOrgnatiaon           = (sdr[_DBTrainOrgnatiaon]).ToString();
                    app.TrainHour                 = Convert.ToInt32(sdr[_DBTrainHour]);
                    app.TrainCost                 = Convert.ToInt32(sdr[_DBTrainCost]);
                    app.EduSpuCost                = HrmisUtility.ConvertToDecimal(sdr[_DbEduSpuCost]);
                    app.HasCertifacation          = (Convert.ToInt32(sdr[_DBHasCertification])).Equals(1);
                    app.NextStep                  = new DiyStep(Convert.ToInt32(sdr[_DBNextStepIndex]));
                    app.TraineeApplicationStatuss =
                        TraineeApplicationStatus.FindTraineeApplicationStatus(Convert.ToInt32(sdr[_DBApplicationStatus]));
                    app.TraineeApplicationDiyProcess = DiyProcessDal.ConvertToObject(sdr[_DbDiyProcess].ToString());

                    if (app.TraineeApplicationDiyProcess != null)
                    {
                        app.CurrentStep = app.TraineeApplicationDiyProcess.FindStep(app.NextStep.DiyStepID);
                    }
                    apps.Add(app);
                }
                return(apps);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="trainAppID"></param>
        /// <returns></returns>
        public List <TraineeApplicationFlow> GetApplicationFlows(int trainAppID)
        {
            SqlCommand cmd = new SqlCommand();
            List <TraineeApplicationFlow> flows = new List <TraineeApplicationFlow>();

            cmd.Parameters.Add(_TrainAppID, SqlDbType.Int).Value = trainAppID;
            using (
                SqlDataReader sdr =
                    SqlHelper.ExecuteReader("GetTrainAppFlowByTrainAppID", cmd))
            {
                while (sdr.Read())
                {
                    TraineeApplicationFlow flow =
                        new TraineeApplicationFlow(new Account(Convert.ToInt32(sdr[_DBOperatorID]), string.Empty, string.Empty),
                                                   Convert.ToDateTime(sdr[_DBOperationTime]),
                                                   TraineeApplicationStatus.FindTraineeApplicationStatus(
                                                       Convert.ToInt32(sdr[_DBOperation])));
                    flow.Remark = sdr[_DBRemark].ToString();
                    flow.TraineeApplicationFlowID = Convert.ToInt32(sdr[_DBPKID]);
                    flows.Add(flow);
                }
                return(flows);
            }
        }
 public void ConfirmLeaveRequestEvent(object source, EventArgs e)
 {
     if (CheckValidate())
     {
         try
         {
             _ITrainFacade.ApproveTraineeApplicationWhole(LoginUser, Convert.ToInt32(_View.OperationView.TrainApplicationID), TraineeApplicationStatus.FindTraineeApplicationStatus(Convert.ToInt32(_View.OperationView.Status)), _View.OperationView.Remark);
         }
         catch (ApplicationException ae)
         {
             _View.OperationView.ResultMessage = ae.Message;
         }
     }
     else
     {
         _View.ResultMessage = string.Empty;
         _ShowUpdatePanel();
     }
     _CompleteEvent();
 }