Пример #1
0
        /// <summary>
        /// 予定職員一覧を登録
        /// </summary>
        private void SaveScheduleStaff()
        {
            DataTable dtScheduleStaff;
            DataRow   drScheduleStaff;
            ItemSet   isScheduleStaff;

            // データテーブル準備
            dtScheduleStaff = clsDataTableControl.GetTable_ScheduleStaff();
            drScheduleStaff = dtScheduleStaff.NewRow();

            try
            {
                // 既存データの削除
                clsDatabaseControl.DeleteScheduleStaff_Ward_TargetMonth(pstrWardID, pstrTargetMonth, pstrStaffKind);

                // メイングリッドから希望シフトを検索
                for (int iStaff = 0; iStaff < lstStaffRight.Items.Count; iStaff++)
                {
                    // ItemSetを作成
                    isScheduleStaff = (ItemSet)lstStaffRight.Items[iStaff];

                    // セットする値の準備
                    drScheduleStaff["ward"]         = pstrWardID;
                    drScheduleStaff["target_month"] = pstrTargetMonth;
                    drScheduleStaff["staff_kind"]   = pstrStaffKind;
                    drScheduleStaff["staff_id"]     = isScheduleStaff.ItemValue.ToString();
                    drScheduleStaff["seq"]          = (iStaff + 1).ToString();
                    drScheduleStaff["office_flag"]  = clsDatabaseControl.GetStaffDayOnly_OfficeFlag(isScheduleStaff.ItemValue.ToString());

                    // INSERT実行
                    clsDatabaseControl.InsertScheduleStaff(drScheduleStaff);
                }

                // 完了メッセージの表示
                MessageBox.Show("保存完了", "", MessageBoxButtons.OK);
            }
            catch (Exception e)
            {
                MessageBox.Show("保存失敗", "", MessageBoxButtons.OK);
                Console.WriteLine("ERROR: " + e.Message);
            }
        }
Пример #2
0
        /// <summary>
        /// 常日勤データを登録
        /// </summary>
        private void SaveStaffDayOnly()
        {
            DataTable dtStaffDayOnly;
            DataTable dtScheduleStaff_Update;
            DataRow   drStaffDayOnly;
            DataRow   drScheduleStaff_Update;

            dtStaffDayOnly = clsDataTableControl.GetTable_StaffDayOnly();
            drStaffDayOnly = dtStaffDayOnly.NewRow();

            dtScheduleStaff_Update = clsDataTableControl.GetTable_ScheduleStaff();
            drScheduleStaff_Update = dtScheduleStaff_Update.NewRow();

            // 既存データの削除
            clsDatabaseControl.DeleteStaffDayOnly_Ward(pstrTargetWard, pstrStaffKind);

            // グリッドのデータを登録
            for (int iRow = 0; iRow < grdStaff.RowCount; iRow++)
            {
                drStaffDayOnly["staff"]            = dtScheduleStaff.Rows[iRow]["id"].ToString();
                drStaffDayOnly["staff_kind"]       = pstrStaffKind;
                drStaffDayOnly["ward"]             = pstrTargetWard;
                drStaffDayOnly["target_day_start"] = grdStaff[1, iRow].Value.ToString();
                drStaffDayOnly["target_day_end"]   = grdStaff[2, iRow].Value.ToString();
                drStaffDayOnly["holiday_flag"]     = clsCommonControl.ChangeHolidayFlagFormat(grdStaff[3, iRow].Value.ToString());
                drStaffDayOnly["office_flag"]      = clsCommonControl.ChangeOfficeFlagFormat(grdStaff[4, iRow].Value.ToString());
                drStaffDayOnly["staff_level"]      = clsCommonControl.ChangeStaffLevelFormat(grdStaff[5, iRow].Value.ToString());

                clsDatabaseControl.InsertStaffDayOnly(drStaffDayOnly);

                drScheduleStaff_Update["staff_id"]     = dtScheduleStaff.Rows[iRow]["id"].ToString();
                drScheduleStaff_Update["target_month"] = pstrTargetMonth;
                drScheduleStaff_Update["office_flag"]  = clsCommonControl.ChangeOfficeFlagFormat(grdStaff[4, iRow].Value.ToString());

                clsDatabaseControl.UpdateScheduleStaff_OfficeFlag(drScheduleStaff_Update);
            }

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