Beispiel #1
0
        private void buttonRegister_Click(object sender, EventArgs e)
        {
            HumanResource hr = GetHumanResource();

            if (null == hr)
            {
                return;
            }

            //社員がいたら更新
            state.Register(hr, connection);

            state = new Default(this);
            state.EnableControl();
        }
Beispiel #2
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            //削除時に不正チェックをする必要はない。
            //HumanResource hr = GetHumanResource();
            //if (null == hr) return;
            HumanResource hr = new HumanResource(this.textBox社員番号.Text, "", "", "");

            var yesno = MessageBox.Show("削除してよろしいですか", "削除確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (yesno != DialogResult.Yes)
            {
                return;
            }

            state.Delete(hr, connection);

            state = new Default(this);
            state.EnableControl();
        }
Beispiel #3
0
        private void SearchEmployee(string employeeNumber)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(@"select * from HumanResource where ""社員番号"" = '").Append(employeeNumber).Append(@"'");
            using (var command = new SqlCommand()
            {
                Connection = connection, CommandText = sb.ToString()
            })
                using (var reader = command.ExecuteReader())
                {
                    try
                    {
                        // SQLの実行
                        if (reader.Read())
                        {
                            HumanResource hr = new HumanResource(
                                reader["社員番号"].ToString(),
                                reader["氏名"].ToString(),
                                reader["入社日"].ToString(),
                                reader["退職日"].ToString()
                                );
                            state = new IsExistEmployee(this, hr);
                        }
                        else
                        {
                            state = new NotExistEmployee(this);
                        }
                        state.EnableControl();
                    }
                    catch (SqlException ex)
                    {
                        throw;
                    }
                }
        }
Beispiel #4
0
            public void Delete(HumanResource hr, SqlConnection connection)
            {
                Delete button = new Delete(hr, connection);

                button.Execute();
            }
Beispiel #5
0
            public void Register(HumanResource hr, SqlConnection connection)
            {
                Update button = new Update(hr, connection);

                button.Execute();
            }
Beispiel #6
0
 public IsExistEmployee(Form1 form, HumanResource hr)
 {
     this.form = form;
     this.hr   = hr;
 }
Beispiel #7
0
 public void Delete(HumanResource hr, SqlConnection connection)
 {
     return;
 }
Beispiel #8
0
            public void Register(HumanResource hr, SqlConnection connection)
            {
                Insert button = new Insert(hr, connection);

                button.Execute();
            }
Beispiel #9
0
 public void Register(HumanResource hr, SqlConnection connection)
 {
     return;
 }
Beispiel #10
0
 internal Update(HumanResource hr, SqlConnection connection)
 {
     this.hr         = hr;
     this.connection = connection;
 }
Beispiel #11
0
 internal Insert(HumanResource hr, SqlConnection connection)
 {
     this.hr         = hr;
     this.connection = connection;
 }
Beispiel #12
0
 internal Delete(string employeeNumber, SqlConnection connection)
 {
     this.hr         = new HumanResource(employeeNumber, "", "", "");
     this.connection = connection;
 }