示例#1
0
        private void staffMasterButtonClick(object sender, EventArgs e)
        {
            StaffMaster personMaster = new StaffMaster(this);

            this.Hide();
            personMaster.Show();
        }
示例#2
0
        private void returnButton_Click(object sender, EventArgs e)
        {
            StaffMaster staffMaster = new StaffMaster(master);

            this.Close();
            staffMaster.Show();
        }
        private void ReturnButton(object sender, EventArgs e)
        {
            StaffMaster personMaster = new StaffMaster(master);

            this.Close();
            personMaster.Show();
        }
        private void updateButton_Click(object sender, EventArgs e)
        {
            NpgsqlConnection     conn = new NpgsqlConnection();
            NpgsqlDataAdapter    adapter;
            NpgsqlCommandBuilder builder;
            DataTable            dt = new DataTable();

            staffName     = this.parsonNameText.Text;                                                                                     //担当者名
            staffNameKana = this.parsonNamt2Text.Text;                                                                                    //担当者名カナ
            password      = this.passwordText.Text;                                                                                       //パスワード
            rePassword    = this.passwordReText.Text;                                                                                     //パスワード再入力
            access_auth   = this.accessButton.Text;                                                                                       //アクセス権限

            conn.ConnectionString = @"Server = 192.168.152.43; Port = 5432; User Id = postgres; Password = postgres; Database = master;"; //変更予定
            conn.Open();
            string sql_str = " update staff_m set  staff_name = '" + staffName + "', staff_name_kana = '" + staffNameKana + "', password = '******', access_auth = '" + access_auth + "' where staff_code =" + staffCode + " ";



            if (string.IsNullOrEmpty(password))//パスワード未入力
            {
                if (string.IsNullOrEmpty(rePassword))
                {
                    MessageBox.Show("パスワードを入力してください");
                    return;
                }
            }
            else
            {
            }


            if (this.passwordText.Text == this.passwordReText.Text)
            {
                adapter = new NpgsqlDataAdapter(sql_str, conn);
                builder = new NpgsqlCommandBuilder(adapter);

                adapter.Fill(dt);
                adapter.Update(dt);
                MessageBox.Show("更新完了");
            }
            else
            {
                MessageBox.Show("更新失敗");
            }


            StaffMaster staffMaster = new StaffMaster(master);

            this.Close();
            staffMaster.Show();
        }
示例#5
0
        private void addButton_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("登録をしますか?", "確認", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                NpgsqlCommandBuilder builder;

                int      staffCode        = int.Parse(parsonCodeText.Text);               //担当者コード
                string   staffName        = this.parsonNameText.Text;                     //担当者名
                string   staffNameKana    = this.parsonNamt2Text.Text;                    //担当者名カナ
                int      mainCategoryCode = (int)this.mainCategoryComboBox.SelectedValue; //大分類初期値
                string   password         = this.passwordText.Text;                       //パスワード
                string   rePassword       = this.passwordReText.Text;                     //パスワード再入力
                string   access_auth      = this.accessButton.Text;                       //アクセス権限
                DateTime dat = DateTime.Now;
                string   d   = dat.ToString();

                string sql_str = "insert into staff_m values(" + staffCode + " , '" + staffName + "', '" + staffNameKana + "'," + mainCategoryCode + ",'" + password + "', '" + access_auth + "," + d + "," + 0 + "')";


                conn.ConnectionString = @"Server = 192.168.152.43; Port = 5432; User Id = postgres; Password = postgres; Database = master;"; //変更予定
                conn.Open();

                adapter = new NpgsqlDataAdapter(sql_str, conn);
                builder = new NpgsqlCommandBuilder(adapter);


                adapter.Fill(dt);
                adapter.Update(dt);

                conn.Close();

                MessageBox.Show("登録完了");


                StaffMaster staffMaster = new StaffMaster(master);
                this.Close();
                staffMaster.Show();
            }
            else
            {
            }
        }
        private void removeButton_Click(object sender, EventArgs e)//削除ボタン
        {
            NpgsqlConnection     conn = new NpgsqlConnection();
            NpgsqlDataAdapter    adapter;
            NpgsqlCommandBuilder builder;


            conn.ConnectionString = @"Server = 192.168.152.43; Port = 5432; User Id = postgres; Password = postgres; Database = master;"; //変更予定

            string sql_str = "delete from staff_m where staff_code = " + staffCode + "";

            conn.Open();


            rePassword = this.passwordReText.Text; //変更予定


            if (password == rePassword)
            {
                adapter = new NpgsqlDataAdapter(sql_str, conn);
                builder = new NpgsqlCommandBuilder(adapter);
                adapter.Fill(dt);
                adapter.Update(dt);
                MessageBox.Show("削除完了");
            }
            else
            {
                MessageBox.Show("削除失敗");
            }



            conn.Close();

            StaffMaster staffMaster = new StaffMaster(master);

            this.Close();
            staffMaster.Show();
        }