示例#1
0
        /// <summary>
        /// This method will refresh the seach control and also empty the necessary editable employee text boxes.
        /// The combo box is also filled with the latest role data
        /// </summary>
        public void SyncControls()
        {
            searchEmployee.SyncControls();
            txtEmployeeName.Text = "";
            txtEmployeeNumber.Text = "";
            txtEmployeeSurname.Text = "";
            //Fill the combobox
            ICollection<Data.Role> Roles = Controller.getRoles();
            Binding.BindableItems cmbItems = Content.Resources["RolesBinding"] as Binding.BindableItems;
            cmbItems.Clear();
            if(Roles.Count > 0)
            {
                foreach(Data.Role r in Roles)
                {
                    Binding.BindingItem i = new Binding.BindingItem()
                    {
                        ID = r.RoleID,
                        DisplayName = r.RoleName,
                    };

                    cmbItems.Add(i);
                }

                cmbRoles.SelectedIndex = 0;
            }
        }
示例#2
0
        /// <summary>
        /// This sync method will get the collection of rates and then fill the rates combo
        /// box. It will also set the textboxes to empty and refresh the search control
        /// </summary>
        public void SyncRoles()
        {
            searchRole.SyncControls();
            txtRoleName.Text = "";
            //Fill the combobox
            ICollection<Data.Rate> Rates = Controller.getRates();
            cmbItems.Clear();
            if (Rates.Count > 0)
            {
                foreach (Data.Rate r in Rates)
                {
                    Binding.BindingItem i = new Binding.BindingItem()
                    {
                        ID = r.RateID,
                        DisplayName = string.Format("{0} {1:c}",r.RateDescription, r.Value),
                    };

                    cmbItems.Add(i);
                }

                cmbRates.SelectedIndex = 0;
            }
        }