///<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);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 通过AssessActivity的PKID查找AssessActivity
        /// </summary>
        public AssessActivity GetAssessActivityById(int id)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.Parameters.Add(_PKID, SqlDbType.Int).Value = id;
            using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetAssessActivityById", cmd))
            {
                while (sdr.Read())
                {
                    AssessActivity assessActivity = new AssessActivity();

                    //rechieve from its main table
                    assessActivity.AssessActivityID    = Convert.ToInt32(sdr[_DbPKID]);
                    assessActivity.ItsEmployee         = RechieveEmployee((int)sdr[_DbEmployeeID]);
                    assessActivity.AssessCharacterType = (AssessCharacterType)sdr[_DbAssessCharacter];
                    assessActivity.ItsAssessStatus     = (AssessStatus)sdr[_DbAssessStatus];
                    assessActivity.ScopeFrom           = Convert.ToDateTime(sdr[_DbScopeFrom]);
                    assessActivity.ScopeTo             = Convert.ToDateTime(sdr[_DbScopeTo]);
                    assessActivity.PersonalGoal        = sdr[_DbPersonalGoal].ToString();
                    assessActivity.AssessProposerName  = sdr[_DbAssessProposerName].ToString();
                    assessActivity.Intention           = sdr[_DbIntention].ToString();// RechieveIntention(sdr[_DbIntention].ToString());
                    assessActivity.Reason                 = sdr[_DbReason].ToString();
                    assessActivity.HRConfirmerName        = sdr[_DbHRConfirmerName].ToString();
                    assessActivity.PersonalExpectedFinish = Convert.ToDateTime(sdr[_DbPersonalExpectedFinish]);
                    assessActivity.ManagerExpectedFinish  = Convert.ToDateTime(sdr[_DbManagerExpectedFinish]);
                    assessActivity.ItsAssessActivityPaper = RechievePaper(sdr[_DbPaperName].ToString(), (decimal)sdr[_DbScore]);
                    assessActivity.EmployeeDept           = sdr[_DbEmployeeDept].ToString();
                    assessActivity.Responsibility         = sdr[_DbResponsibility].ToString();
                    assessActivity.NextStepIndex          = Convert.ToInt32(sdr[_DBNextStepIndex]);
                    assessActivity.DiyProcess             = DiyProcessDal.ConvertToObject(sdr[_DbDiyProcess].ToString());
                    if (sdr[_DbIfEmployeeVisible].ToString() == "1")
                    {
                        assessActivity.IfEmployeeVisible = true;
                    }
                    //rechieve from its paper table
                    RechieveItsPaper(assessActivity);
                    //rechieve from tis item table
                    RechieveItsItem(assessActivity.ItsAssessActivityPaper.PaperName, assessActivity);

                    return(assessActivity);
                }
            }
            return(null);
        }
        ///<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);
            }
        }