Пример #1
0
    public override void RemoveWorker(CSPersonnel npc)
    {
        base.RemoveWorker(npc);
        if (InstructorNpcId == npc.ID)
        {
            if (m_Counter != null)
            {
                StopCounter();
            }
            TraineeNpcId = -1;
        }

        if (TraineeNpcId == npc.ID)
        {
            if (m_Counter != null)
            {
                StopCounter();
            }
            TraineeNpcId = -1;
        }
        InstructorList.Remove(npc.ID);
        TraineeList.Remove(npc.ID);

        UpdateUI();
    }
Пример #2
0
        private void BindData()
        {
            TraineeBLL trainee = new TraineeBLL(connectionString);

            TraineeList.DataSource = trainee.GetAllTrainees();
            TraineeList.DataBind();
        }
Пример #3
0
    public bool CheckNpc()
    {
        if (InstructorNpcId <= 0 || TraineeNpcId <= 0)
        {
            return(false);
        }
        CSPersonnel instructorP = m_MgCreator.GetNpc(InstructorNpcId);

        if (instructorP == null)
        {
            return(false);
        }
        if (instructorP.Occupation != CSConst.potTrainer)
        {
            InstructorList.Remove(instructorP.ID);
            instructorP.trainerType = ETrainerType.none;
            InstructorNpcId         = -1;
            return(false);
        }
        CSPersonnel traineeP = m_MgCreator.GetNpc(TraineeNpcId);

        if (traineeP == null)
        {
            return(false);
        }
        if (traineeP.Occupation != CSConst.potTrainer)
        {
            TraineeList.Remove(traineeP.ID);
            traineeP.trainerType = ETrainerType.none;
            TraineeNpcId         = -1;
            return(false);
        }
        return(true);
    }
Пример #4
0
    public bool AddTrainee(CSPersonnel p)
    {
        if (TraineeList.Contains(p.ID))
        {
            return(true);
        }
        if (TraineeList.Count >= MAX_TRAINEE_NUM)
        {
            return(false);
        }
        if (InstructorNpcId == p.ID)
        {
            if (m_Counter != null)
            {
                StopCounter();
            }
            InstructorNpcId = -1;
        }
        InstructorList.Remove(p.ID);
        TraineeList.Add(p.ID);
        p.trainerType = ETrainerType.Trainee;

        UpdateUI();
        return(true);
    }
Пример #5
0
    public bool AddInstructor(CSPersonnel p)
    {
        if (InstructorList.Contains(p.ID))
        {
            return(true);
        }
        if (InstructorList.Count >= MAX_INSTRUCTOR_NUM)
        {
            return(false);
        }
        if (TraineeNpcId == p.ID)
        {
            if (m_Counter != null)
            {
                StopCounter();
            }
            TraineeNpcId = -1;
        }
        TraineeList.Remove(p.ID);
        InstructorList.Add(p.ID);
        p.trainerType = ETrainerType.Instructor;

        UpdateUI();
        return(true);
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         // retrieve data from database and populate it into the drodown list
         List <TraineeViewModel> trainees = tbll.GetAllTrainees();
         TraineeList.DataSource     = trainees;
         TraineeList.DataTextField  = "FirstName";
         TraineeList.DataValueField = "TraineeID";
         TraineeList.DataBind();
         TraineeList.Items.Insert(0, "--Select a trainee from the list--");
     }
 }
Пример #7
0
    public bool CheckTraineeId(int traineeId)
    {
        CSPersonnel trainee = m_MgCreator.GetNpc(traineeId);

        if (trainee == null || trainee.m_Occupation != CSConst.potTrainer)
        {
            return(false);
        }
        if (!TraineeList.Contains(traineeId))
        {
            return(false);
        }
        return(true);
    }
Пример #8
0
    public bool CheckInstructorAndTraineeId(int instructorId, int traineeId)
    {
        CSPersonnel instructorNpc = m_MgCreator.GetNpc(instructorId);
        CSPersonnel traineeNpc    = m_MgCreator.GetNpc(traineeId);

        if (instructorNpc == null || traineeNpc == null)
        {
            return(false);
        }
        if (instructorNpc.m_Occupation != CSConst.potTrainer || traineeNpc.m_Occupation != CSConst.potTrainer)
        {
            return(false);
        }
        if (!InstructorList.Contains(instructorId) || !TraineeList.Contains(traineeId))
        {
            return(false);
        }
        return(true);
    }
Пример #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ScheduleBLL scbll = new ScheduleBLL();
                Schedule    sc    = scbll.GetScheduleById(Convert.ToInt32(Request.QueryString["ScheduleID"]));

                // Loading the dropdownlist
                List <TraineeViewModel> trainees = tbll.GetAllTrainees();
                TraineeList.DataSource     = trainees;
                TraineeList.DataTextField  = "FirstName";
                TraineeList.DataValueField = "TraineeID";
                TraineeList.DataBind();
                TraineeList.Items.Insert(0, "--Select a trainee from the list--");
                TraineeList.SelectedValue = sc.TraineeID.ToString();
                DateOfAppointment.Text    = sc.ScheduleDtTime.ToString("yyyy-MM-dd"); //The format has to be like this: "yyyy-mm-dd" otherwise it won't show in the browser
                //DateOfAppointment.Text = sc.DisplayScheduleDtTime.ToString();
                TimeOfAppointment.Text = sc.InputDtTime.ToString("HH:mm");
            }
        }