示例#1
0
        public async Task ShouldListAllStaff()
        {
            var mockRepo = new Mock <IDataRepository>();

            mockRepo.Setup(repo => repo.StaffListAsync()).
            ReturnsAsync(GetStaffData());

            StaffController controller = new StaffController(mockRepo.Object);
            var             result     = await controller.GetAllStaffMembers();

            Assert.IsInstanceOfType(result.Result, typeof(OkObjectResult));
            var okResult = result.Result as OkObjectResult;

            var staff = okResult.Value as List <Staff>;

            Assert.AreEqual(2, staff.Count);

            Assert.AreEqual("nst", staff[0].Uid);
            Assert.AreEqual("Neil", staff[0].Forename);
            Assert.AreEqual("Taylor", staff[0].Surname);

            Assert.AreEqual("nwh", staff[1].Uid);
            Assert.IsNull(staff[1].Forename);
            Assert.IsNull(staff[1].Surname);
        }
示例#2
0
        public MainWindow()
        {
            InitializeComponent();

            staffController = new StaffController();
            unitController  = new UnitController();

            currentStaffList = staffController.GetAllStaff();
            currentUnitList  = unitController.GetAllUnit();

            //Inital staff view page
            List <Teaching.Type.Category> temp = Enum.GetValues(typeof(Teaching.Type.Category)).Cast <Teaching.Type.Category>().ToList();

            staff_category.Items.Add("All");
            foreach (Teaching.Type.Category campus in temp)
            {
                staff_category.Items.Add(campus);
            }
            staff_category.SelectedItem = "All";

            foreach (Staff staff in currentStaffList)
            {
                staff_staffList.Items.Add(staff.giveName + " " + staff.familyName);
            }
        }
示例#3
0
        //Filter staff list by category
        private void CategorySorter_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Category        cat  = (Category)e.AddedItems[0];
            StaffController boss = (StaffController)Application.Current.FindResource("boss");

            boss.Filter(cat);
        }
示例#4
0
        private void lblStaffId_TextChanged(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedCells.Count > 0 && !string.IsNullOrEmpty(lblId.Text))
            {
                int id = (int)dataGridView1.SelectedCells[0].OwningRow.Cells["StaffId"].Value;

                staffController = new StaffController();
                var staff = staffController.Get(id);
                lblStaffName.Text        = staff.Name;
                cbxPosition.SelectedItem = staff.Position;

                bool status = (bool)dataGridView1.SelectedCells[0].OwningRow.Cells["Status"].Value;

                if (status)
                {
                    btnLock.Visible   = true;
                    btnUnlock.Visible = false;
                    button1.Visible   = true;
                }
                else
                {
                    btnLock.Visible   = false;
                    btnUnlock.Visible = true;
                    button1.Visible   = false;
                }

                if (!staff.Status)
                {
                    btnUnlock.Visible = false;
                }
            }
        }
示例#5
0
 public CreateAccount()
 {
     staffController = new StaffController();
     InitializeComponent();
     initListStaff();
     initListRole();
 }
示例#6
0
        public void MarkArrivedSuccess()
        {
            var mockUser = University.GetUser("o103");

            StaffController sc = new StaffController();

            sc.ControllerContext = new ControllerContext(MockAuthContext(mockUser).Object, new RouteData(), sc);

            //list visitors
            ViewResult result = sc.ListVisitors("", "", null, 1) as ViewResult;

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result.Model, typeof(PagedList <Visitor>));
            PagedList <Visitor> visitors = result.Model as PagedList <Visitor>;

            Assert.AreEqual(1, visitors.Count);

            Visitor visitor = visitors.FirstOrDefault();

            Assert.AreEqual(VisitorStatus.WaitingForArrival, visitor.Status);

            RedirectToRouteResult resultArrive = sc.VisitorArrived(visitor.ID) as RedirectToRouteResult;

            Assert.IsNotNull(result);
            Assert.AreEqual(null, resultArrive.RouteValues["controller"]);
            Assert.AreEqual("ListVisitors", resultArrive.RouteValues["action"]);
            Assert.AreEqual(1, resultArrive.RouteValues["success"]);

            //list visitors again
            result = sc.ListVisitors("", "", null, 1) as ViewResult;
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result.Model, typeof(PagedList <Visitor>));
            visitors = result.Model as PagedList <Visitor>;
            Assert.AreEqual(0, visitors.Count);
        }
示例#7
0
        private void loadName_Date()
        {
            var staff = new StaffController().Get(staffId);

            lblNameStaff.Text = staff.Name;
            lblDate.Text      = DateTime.Now.ToString("dd-MM-yyyy");
        }
示例#8
0
        private static void AddEmployee(Settings.DirectorAddEmployeeMenuItem menuAddEmployeeItem)
        {
            EmployeeService employeeService = new EmployeeService(employeeRepository);

            if (menuAddEmployeeItem != Settings.DirectorAddEmployeeMenuItem.Back)
            {
                GetLastNameAndSalary(out string lastName, out decimal salary);
                switch (menuAddEmployeeItem)
                {
                case Settings.DirectorAddEmployeeMenuItem.AddDirector:
                    DirectorController directorController = new DirectorController(employeeService);
                    GetBonus(out decimal bonus);
                    directorController.AddDirector(new Director(lastName, salary, bonus));
                    break;

                case Settings.DirectorAddEmployeeMenuItem.AddProger:
                    StaffController staffController = new StaffController(employeeService);
                    staffController.AddStaffEmployee(new Proger(lastName, salary));
                    break;

                case Settings.DirectorAddEmployeeMenuItem.AddFreelancer:
                    FreelancerController freelancerController = new FreelancerController(employeeService);
                    freelancerController.AddFreelancer(new Freelancer(lastName, salary));
                    break;

                default:
                    break;
                }
            }
        }
        public void GetSavedIncome_Can_Retrieve_Staff_Saved_Income_Successfully()
        {
            var controller    = new StaffController(_staffServiceMock.Object);
            var apiCallResult = controller.GetSavedIncome(_sampleStaffs[0].Id);

            Assert.IsInstanceOfType(apiCallResult, typeof(OkNegotiatedContentResult <List <Income> >));
        }
        public void GetSavedExpenses_Retrieves_All_Expenses_By_Staff()
        {
            var controller    = new StaffController(_staffServiceMock.Object);
            var apiCallResult = controller.GetAllSavedExpenses(_sampleStaffs[1].Id);

            Assert.IsInstanceOfType(apiCallResult, typeof(OkNegotiatedContentResult <List <Expense> >));
        }
        public void Get_Retrieves_All_Saved_Staffs()
        {
            var controller    = new StaffController(_staffServiceMock.Object);
            var apiCallResult = controller.Get();

            Assert.IsInstanceOfType(apiCallResult, typeof(OkNegotiatedContentResult <List <Staff> >));
        }
示例#12
0
        private void button3_Click(object sender, EventArgs e)
        {
            string          staffId         = txtStaffId.Text;
            StaffController staffController = new StaffController();
            bool            i = staffController.DeleteStaff(staffId);

            if (i == true)
            {
                MessageBox.Show("Selected Staff Deleted Successfully!");
                txtStaffId.Text        = "";
                txtName.Text           = "";
                txtAddress.Text        = "";
                txtGender.Text         = "";
                txtDOB.Text            = "";
                txtContactNumber.Text  = "";
                txtBloodGroup.Text     = "";
                txtFatherName.Text     = "";
                txtMother.Text         = "";
                txtPContactNumber.Text = "";
                txtDesignation.Text    = "";
                txtBlock.Text          = "";
                txtStatus.Text         = "";

                txtSearch.Text = "";
            }
            else
            {
                MessageBox.Show("Selected Staff is not Deleted.");
            }
        }
        public static void ConfirmRecivedItems(string DI, List <DisbursementDetail> ddlist)
        {
            Staff rep = new Staff();

            using (InventorySysDBEntities cntx = new InventorySysDBEntities())
            {
                //update disbursmentdetail
                foreach (DisbursementDetail dd in ddlist)
                {
                    updateDisbursmentDetail(cntx, dd);
                }

                //update disbursment
                Disbursement disbursment = cntx.Disbursements.Find(DI);
                rep = StaffController.getRepByDepID(disbursment.Dept_ID);

                disbursment.Receive_Date = DateTime.Now;
                disbursment.Status       = "Recieved";

                // update Requisition
                List <Requisition> reqList = getRequisitionsByDI(DI);
                foreach (Requisition req in reqList)
                {
                    Requisition reqData = cntx.Requisitions.Find(req.Requisition_ID);
                    reqData.Status = "Received";
                }

                cntx.SaveChanges();
            }
            SendNotificationController.SendNotificaition(rep, DI);
        }
        public void Get_Staff_Category_Works_Correctly()
        {
            var controller    = new StaffController(_staffServiceMock.Object);
            var apiCallResult = controller.GetStaffCategory(_sampleStaffs[0].Id);

            Assert.IsInstanceOfType(apiCallResult, typeof(OkNegotiatedContentResult <int>));
        }
示例#15
0
 void Start()
 {
     getMoneyController = GameObject.Find("GetMoney").GetComponent<GetMoneyController>();
     staffController = GameObject.Find("HireStaff").GetComponent<StaffController>();
     astronautController = GameObject.Find("Astronaut").GetComponent<AstronautController>();
     researchersController = GameObject.Find("Researcher").GetComponent<ResearcherController>();
 }
示例#16
0
        public ViewStaffForm()
        {
            InitializeComponent();

            logger.Info("Initialising view staff form");

            // prepare the listView
            listView_staff.Columns.Add("ID", 50);
            listView_staff.Columns.Add("Full name", 200);
            listView_staff.Columns.Add("Password", 300);
            listView_staff.Columns.Add("Privelege", 75);
            listView_staff.View      = System.Windows.Forms.View.Details;
            listView_staff.GridLines = true;
            // make the headers bold
            for (int i = 0; i < listView_staff.Columns.Count; i++)
            {
                listView_staff.Columns[i].ListView.Font = new Font(listView_staff.Columns[i].ListView.Font, FontStyle.Bold);
            }

            // colour and position the busy indicator properly
            circularProgressBar1.Location      = calculateBusyIndicatorPos();
            circularProgressBar1.ProgressColor = Configuration.ProgressBarColours.TASK_IN_PROGRESS_COLOUR;
            showBusyIndicator();

            // can't delete anything until something is selected
            button_deleteSelectedStaff.Enabled = false;

            // controller dependency injection
            controller = new StaffController();
        }
示例#17
0
        static void UpdateStaff()
        {
            Staff staff = new Staff();

            staff.CurrentPosition      = "Chiefasdfasdf";
            staff.AppointmentNumber    = 1;
            staff.CurrentSalary        = 2.2;
            staff.DateOfBirth          = new DateTime(1999, 09, 12);
            staff.FirstName            = "John";
            staff.FullAddress          = "den nye vej 9";
            staff.Gender               = "male";
            staff.InsuranceNumber      = 1;
            staff.LastName             = "Doee";
            staff.NumberOfHoursPerWeek = 1;
            staff.PermenentOrTemporary = "temp";
            staff.QualificationID      = 1;
            staff.SalaryPayment        = "week";
            staff.SalaryScale          = "c";
            staff.StaffNumber          = 1;
            staff.WorkExperienceID     = 1;

            StaffController sc = new StaffController();
            int             id = 1;
            SqlException    s  = sc.Update(staff, id);
        }
示例#18
0
文件: Staff.cs 项目: zjkl19/BPMS01
        public void Can_Send_gender_ViewModel()
        {
            //arrange
            Mock <IStaffRepository> mock = new Mock <IStaffRepository>();

            mock.Setup(m => m.staff).Returns(new staff[]    {
                new staff {
                    id           = Guid.NewGuid(),
                    no           = 1743,
                    password     = "******",
                    name         = "林迪南",
                    gender       = Convert.ToInt32(gender.male),
                    office_phone = "123456",
                    mobile_phone = "123456",
                    position     = 1,
                    job_title    = 1,
                    education    = 1,
                    hiredate     = Convert.ToDateTime("2016-07-25")
                },
            });
            //arrange: create controller
            var myController = new StaffController(mock.Object);

            //act:
            var result = (AddStaffViewModel)myController.AddStaff().Model;

            //assert
            var p = result.gender;

            //Text = m.GetType().GetProperty("Name").ToString(),
            Assert.AreEqual(p.GetType().GetProperty("Name").ToString(), "男");
        }
示例#19
0
        public NewStaffForm()
        {
            InitializeComponent();

            // log it
            logger.Info("Initialising new staff form");

            // prepare the comboBox
            comboBox_privelege.Items.Add("Admin");
            comboBox_privelege.Items.Add("Normal");

            // controller dependency injection
            controller = new StaffController();

            // cannot add anything yet
            button_addStaff.Enabled = false;

            // event handlers for data entry controls
            textBox_fullName.TextChanged       += checkEntries;
            textBox_password.TextChanged       += checkEntries;
            textBox_repeatPassword.TextChanged += checkEntries;

            // status bar colour
            labelProgressBar1.setColourAndText(Configuration.ProgressBarColours.IDLE_COLOUR, "Ready");
            labelProgressBar1.Value = 100;
        }
示例#20
0
        //Search staff list by staff name
        private void BtnStaffSearch_Click(object sender, RoutedEventArgs e)
        {
            String          name = (String)StaffSearch.Text;
            Category        cat  = (Category)CategorySorter.SelectedItem;
            StaffController boss = (StaffController)Application.Current.FindResource("boss");

            boss.StaffSearch(name, cat);
        }
示例#21
0
 //Initialize the main window
 public MainWindow()
 {
     InitializeComponent();
     StaffRightFrame.Visibility   = Visibility.Hidden;
     UnitRightFrame.Visibility    = Visibility.Hidden;
     CategorySorter.SelectedIndex = 0;
     boss = (StaffController)(Application.Current.FindResource(STAFF_LIST_KEY) as ObjectDataProvider).ObjectInstance;
 }
示例#22
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="AddAppointmentForm" /> class.
 /// </summary>
 /// <param name="patientId">The patient identifier for whom to create an appointment.</param>
 public AddAppointmentForm(int patientId)
 {
     this.InitializeComponent();
     this.dateTimeAppointment.MinDate = DateTime.Today;
     this.staffController             = new StaffController();
     this.patientId = patientId;
     this.loadStaff();
 }
        public void Get_With_Parameter_Retrieves_A_Saved_Staff()
        {
            var controller    = new StaffController(_staffServiceMock.Object);
            var apiCallResult = controller.Get(_sampleStaffs[0].Id);

            Assert.IsNotNull(apiCallResult);
            Assert.IsInstanceOfType(apiCallResult, typeof(OkNegotiatedContentResult <Staff>));
        }
示例#24
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="OrderLabTestForm" /> class.
 /// </summary>
 /// <param name="apt">The appointment to order a test for.</param>
 public OrderLabTestForm(Appointment apt)
 {
     this.InitializeComponent();
     this.staffController = new StaffController();
     this.ltController    = new LabTestController();
     this.ltoController   = new LabTestOrderedController();
     this.apt             = apt;
     this.setUpForm();
 }
示例#25
0
        public ListStaff()
        {
            InitializeComponent();

            staffController = new StaffController();
            initCommon();
            conn = new ConnectServer(Constants.server, Constants.user, Constants.password);
            initListStaff();
        }
示例#26
0
        public void Index()
        {
            StaffController       sc     = new StaffController();
            RedirectToRouteResult result = sc.Index() as RedirectToRouteResult;

            Assert.IsNotNull(result);
            Assert.AreEqual(null, result.RouteValues["controller"]);
            Assert.AreEqual("ListVisitors", result.RouteValues["action"]);
        }
示例#27
0
 void Start()
 {
     rb2d            = GetComponent <Rigidbody2D>();
     boulderCollider = GetComponent <CircleCollider2D>();
     anim            = GetComponent <Animator>();
     boulderDistance = 1;
     hDirection      = 0;
     staff           = StaffController.staff;
     pS = playerStats.stats;
 }
示例#28
0
        private void loadStaffs(string searchString, string position, bool?status)
        {
            if (staffController == null)
            {
                staffController = new StaffController();
            }

            tblStaffs.DataSource = staffController.Gets(searchString, position, status).ToList();
            dataGridView1.Columns["Img"].Visible = false;
        }
示例#29
0
        private void ViewTimetableButton_Click(object sender, EventArgs e)
        {
            var date        = getSelectedDate();
            var staffMember = RegisterListBox.GetItemText(RegisterListBox.SelectedItem);

            // Collect the data from the database
            var timetable = StaffController.ProduceTimetable(date, staffMember);

            TimetableListBox.DataSource = null;
            TimetableListBox.DataSource = timetable;
        }
示例#30
0
        private void button1_Click(object sender, EventArgs e)
        {
            string name           = txtName.Text;
            string address        = txtAddress.Text;
            string DOB            = txtDOB.Text;
            string gender         = txtGender.Text;
            string contactNumber  = txtContactNumber.Text;
            string bloodGroup     = txtBloodGroup.Text;
            string fatherName     = txtFatherName.Text;
            string motherName     = txtMotherName.Text;
            string pContactNumber = txtPContactNumber.Text;
            string designtion     = txtDesignation.Text;
            string block          = txtBlock.Text;
            string status         = txtStatus.Text;

            Staff staff = new Staff();

            staff.setName(name);
            staff.setAddress(address);
            staff.setDOB(DOB);
            staff.setGender(gender);
            staff.setContactNumber(contactNumber);
            staff.setBloodGroup(bloodGroup);
            staff.setFatherName(fatherName);
            staff.setMotherName(motherName);
            staff.setPContactNumber(pContactNumber);
            staff.setDesignation(designtion);
            staff.setBlock(block);
            staff.setStatus(status);

            StaffController staffController = new StaffController();
            bool            i = staffController.AddStaff(staff);

            if (i == true)
            {
                MessageBox.Show("Staff Added Successfully");
                txtName.Text           = "";
                txtAddress.Text        = "";
                txtDOB.Text            = "";
                txtGender.Text         = "";
                txtContactNumber.Text  = "";
                txtBloodGroup.Text     = "";
                txtFatherName.Text     = "";
                txtMotherName.Text     = "";
                txtPContactNumber.Text = "";
                txtDesignation.Text    = "";
                txtBlock.Text          = "";
                txtStatus.Text         = "";
            }
            else
            {
                MessageBox.Show("Staff Not Added");
            }
        }
示例#31
0
 // Use this for initialization
 void Awake()
 {
     //This allows this object to be the only object in existance
     if (staff == null)
     {
         staff = this;
     }
     else if (staff != this)
     {
         Destroy(gameObject);
     }
 }
 public void OpenCreateStaff()
 {
     var controller = new StaffController();
     var result = controller.Create() as ViewResult;
     Assert.AreEqual("Create", result.ViewName);
 }
示例#33
-1
 void Start()
 {
     _gtc = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameTimeController>();
     _sc = GameObject.FindGameObjectWithTag("GameController").GetComponent<StaffController>();
     _gtc.MonthElasped += MonthElapsed;
 }