示例#1
0
        /// <summary>
        /// DBに職員情報を登録
        /// </summary>
        private void InsertStaffData()
        {
            DataTable dtStaff;
            DataRow   drStaff;

            // DataTable、DataRowを初期化
            dtStaff = clsDataTableControl.GetTable_Staff();
            drStaff = dtStaff.NewRow();

            // 各種値をDataRowにセット
            drStaff["id"]             = txtID.Text;
            drStaff["name"]           = txtName.Text;
            drStaff["sex"]            = cmbSex.SelectedValue;
            drStaff["ward"]           = cmbWard.SelectedValue;
            drStaff["staff_kind"]     = cmbStaffKind.SelectedValue.ToString().Substring(0, 2);
            drStaff["staff_kind_sub"] = cmbStaffKind.SelectedValue.ToString().Substring(2, 2);
            drStaff["staff_position"] = cmbStaffPosition.SelectedValue;
            drStaff["seq"]            = int.Parse(clsDatabaseControl.GetStaff_MaxSEQ(cmbWard.SelectedValue.ToString())) + 1;
            drStaff["using_flag"]     = cmbUsingFlag.SelectedValue;
            drStaff["created_date"]   = DateTime.Now.ToString();
            drStaff["updated_date"]   = DateTime.Now.ToString();

            // データ登録処理
            clsDatabaseControl.InsertStaff(drStaff);

            // 完了メッセージの表示
            MessageBox.Show("保存完了しました。", "", MessageBoxButtons.OK);
        }
        /// <summary>
        /// 職員並び順の保存
        /// </summary>
        private void SaveStaffSort()
        {
            DataTable dtStaff;
            DataRow   drStaff;
            ItemSet   isTemp;

            // DataTable、DataRowを初期化
            dtStaff = clsDataTableControl.GetTable_Staff();

            for (int iSEQ = 1; iSEQ < lstStaff.Items.Count; iSEQ++)
            {
                drStaff = dtStaff.NewRow();
                isTemp  = lstStaff.Items[iSEQ - 1] as ItemSet;

                drStaff["id"]  = isTemp.ItemValue;
                drStaff["seq"] = iSEQ;

                clsDatabaseControl.UpdateStaff_SEQ(drStaff);
            }

            MessageBox.Show("保存完了", "");
        }