コード例 #1
0
        private void Create_Click(object sender, EventArgs e)
        {
            string namee = name.Text, passwordd = password.Text, id = "1", status = "";

            if ((radioButton1.Checked || radioButton3.Checked) && (namee.Length > 0 && passwordd.Length > 0))
            {
                if (radioButton1.Checked)
                {
                    status = radioButton1.Text;
                }
                else
                {
                    status = radioButton3.Text;
                }

                EmployeeFile.readEmployeeFile();
                EmployeeFile employeeFile = new EmployeeFile();
                employeeFile.id       = id = getIdOfEmp();
                employeeFile.name     = namee;
                employeeFile.password = passwordd;
                employeeFile.role     = status;
                EmployeeFile.employeeFiles.Add(employeeFile);
                EmployeeFile.writeEmployeeFile();

                MessageBox.Show("employee ID = " + id);
            }
            else
            {
                MessageBox.Show("please check your data");
            }
        }
コード例 #2
0
 private List <EmployeeFile> loademp()
 {
     UserID.Items.Clear();
     EmployeeFile.readEmployeeFile();
     for (int i = 0; i < EmployeeFile.employeeFiles.Count; i++)
     {
         if (EmployeeFile.employeeFiles[i].role == "User")/**************************************/
         {
             UserID.Items.Add(EmployeeFile.employeeFiles[i].id);
         }
     }
     return(EmployeeFile.employeeFiles);
 }
コード例 #3
0
        public void LoadUsers(string selsected_project_id)
        {
            UserID.Items.Clear();
            UserID.Text         = "";
            UserID.SelectedItem = null;
            List <string> selected_project_user_ids = Get_User_Ids_Of_Selected_Project(selsected_project_id);

            EmployeeFile.readEmployeeFile();
            List <EmployeeFile> list = EmployeeFile.employeeFiles;

            for (int i = 0; i < list.Count; i++)
            {
                if (!selected_project_user_ids.Contains(list[i].id.ToString()) && list[i].role.ToString() == "User")
                {
                    UserID.Items.Add(list[i].id.ToString());
                }
            }
        }
コード例 #4
0
        public void Get_Selected_Employee()
        {
            // get selected employee
            string Selected_User_Id = UserID.SelectedItem.ToString();

            EmployeeFile.readEmployeeFile();
            List <EmployeeFile> lis = EmployeeFile.employeeFiles;

            for (int i = 0; i < lis.Count; i++)
            {
                if (lis[i].id.ToString() == Selected_User_Id)
                {
                    Selected_Employee      = new Employee();
                    Selected_Employee.id   = int.Parse(lis[i].id);
                    Selected_Employee.name = lis[i].name;
                    Selected_Employee.role = lis[i].role;
                    break;
                }
            }
        }
コード例 #5
0
 private string getIdOfEmp()
 {
     EmployeeFile.readEmployeeFile();
     return((EmployeeFile.employeeFiles.Count + 1).ToString());
 }