Ejemplo n.º 1
0
        private void btnAdd_Click_1(object sender, RoutedEventArgs e)
        {
            EmployeeEditWindow editWin = new EmployeeEditWindow();

            editWin.EditerDptID = LoginerDepartmentID;
            editWin.IsEdited    = false;
            if (LoginerRankName == "Manager")
            {
                editWin.tbDepartment.Visibility  = Visibility.Hidden;
                editWin.cmbDepartment.Visibility = Visibility.Hidden;
                editWin.cmbRank.Visibility       = Visibility.Hidden;
                editWin.tbRank.Visibility        = Visibility.Hidden;
                editWin.EditerRank = 1;
                editWin.ShowDialog();
                if (editWin.DialogResult == true)
                {
                    LoadDepartmentData();
                }
            }
            else if (LoginerRankName == "President")
            {
                editWin.EditerRank = 2;

                editWin.ShowDialog();
                if (editWin.DialogResult == true)
                {
                    LoadData();
                }
            }
        }
Ejemplo n.º 2
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            Employee employee = (Employee)datagrid.SelectedItem;

            if (employee == null)
            {
                MessageBox.Show("Please select one record to edit.");
                return;
            }
            else
            {
                EmployeeEditWindow editWin = new EmployeeEditWindow();
                editWin.SelectedUserName = employee.UserName;
                editWin.IsEdited         = true;
                //if (LoginerRankName == "Staff")
                //{
                //    editWin.dpContractEndDate.Visibility = Visibility.Hidden;
                //    editWin.dpContractStartDate.Visibility = Visibility.Hidden;
                //    editWin.cmbDepartment.Visibility = Visibility.Hidden;
                //    editWin.cmbGender.Visibility = Visibility.Hidden;
                //    editWin.cmbRank.Visibility = Visibility.Hidden;
                //    editWin.tbDepartment.Visibility = Visibility.Hidden;
                //    editWin.tbRank.Visibility = Visibility.Hidden;
                //    editWin.txtUserName.Visibility = Visibility.Hidden;
                //    editWin.dpBirthday.Visibility = Visibility.Hidden;
                //    editWin.tbBirthday.Visibility = Visibility.Hidden;
                //    editWin.tbConStart.Visibility = Visibility.Hidden;
                //    editWin.tbConEnd.Visibility = Visibility.Hidden;
                //    editWin.tbGender.Visibility = Visibility.Hidden;
                //    editWin.ShowDialog();
                //    if (editWin.DialogResult == true)
                //    {
                //        LoadSingleData();
                //    }

                //}
                if (LoginerRankName == "Manager")
                {
                    editWin.tbDepartment.Visibility  = Visibility.Hidden;
                    editWin.cmbDepartment.Visibility = Visibility.Hidden;
                    editWin.cmbRank.Visibility       = Visibility.Hidden;
                    editWin.tbRank.Visibility        = Visibility.Hidden;
                    editWin.ShowDialog();
                    if (editWin.DialogResult == true)
                    {
                        LoadDepartmentData();
                    }
                }
                else if (LoginerRankName == "President")
                {
                    editWin.ShowDialog();
                    if (editWin.DialogResult == true)
                    {
                        LoadData();
                    }
                }
            }
        }