/// <summary> /// 環境設定情報を取得します /// </summary> public static void GetCommonYearMonth() { Model.SysControl.SetDBConnect sDB = new Model.SysControl.SetDBConnect(); OleDbCommand sCom = new OleDbCommand(); sCom.Connection = sDB.cnOpen(); string mySql = "select * from 環境設定"; sCom.CommandText = mySql; OleDbDataReader dr = sCom.ExecuteReader(); try { while (dr.Read()) { sYear = int.Parse(dr["SYEAR"].ToString()); sMonth = int.Parse(dr["SMONTH"].ToString()); sMSTS = dr["MSTS"].ToString(); sMSTJ = dr["MSTJ"].ToString(); sTIF = dr["TIF"].ToString(); sTIF2 = dr["TIF2"].ToString(); sDAT = dr["DAT"].ToString(); sDAT2 = dr["DAT2"].ToString(); sBKDELS = int.Parse(dr["BKDELS"].ToString()); sBKDELP = int.Parse(dr["BKDELP"].ToString()); // 2017/03/13 sTimeYukyu = Utility.StrToInt(Utility.NulltoStr(dr["時間単位有休処理"])); } } catch (Exception ex) { MessageBox.Show(ex.Message, "環境設定年月取得", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } finally { if (dr.IsClosed == false) { dr.Close(); } if (sCom.Connection.State == ConnectionState.Open) { sCom.Connection.Close(); } } }
/// <summary> /// マスター(CSV)パスを取得します /// </summary> private void GetStaffMstPath() { Model.SysControl.SetDBConnect sDB = new Model.SysControl.SetDBConnect(); OleDbCommand sCom = new OleDbCommand(); sCom.Connection = sDB.cnOpen(); string mySql = "select * from 環境設定"; sCom.CommandText = mySql; OleDbDataReader dr = sCom.ExecuteReader(); try { while (dr.Read()) { sMstPath = dr["MSTS"].ToString(); pMstPath = dr["MSTJ"].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "マスター(CSV)パス取得", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } finally { if (dr.IsClosed == false) { dr.Close(); } if (sCom.Connection.State == ConnectionState.Open) { sCom.Connection.Close(); } } }
///----------------------------------------------------------------------------- /// <summary> /// データグリッドビューにデータを表示します /// : 西暦対応 2019/02/12 </summary> /// <param name="tempGrid"> /// データグリッドビューオブジェクト</param> /// <param name="usr"> /// スタッフ:0, パート:1</param> ///----------------------------------------------------------------------------- public static void Show(DataGridView tempGrid, int usr, int rBtn) { // 2019/02/12 コメント化 //// 和暦表示用 //CultureInfo culture = new CultureInfo("ja-JP", true); //culture.DateTimeFormat.Calendar = new System.Globalization.JapaneseCalendar(); // データベース接続 Model.SysControl.SetDBConnect sDB = new Model.SysControl.SetDBConnect(); OleDbCommand sCom = new OleDbCommand(); sCom.Connection = sDB.cnOpen(); if (usr == global.STAFF_SELECT) { sCom.CommandText = "select * from スタッフマスタ "; if (rBtn == 0) { sCom.CommandText += "where 給与区分 = ? and mid(オーダーコード,1,1) <> ? "; } else if (rBtn == 1) { sCom.CommandText += "where 給与区分 = ? and mid(オーダーコード,1,1) = ? "; } sCom.CommandText += "order by ID"; sCom.Parameters.Clear(); sCom.Parameters.AddWithValue("@1", "時間給"); sCom.Parameters.AddWithValue("@2", "3"); OleDbDataReader dr = sCom.ExecuteReader(); // マスタ読み込み int iX = 0; tempGrid.RowCount = 0; while (dr.Read()) { tempGrid.Rows.Add(); tempGrid[col_ID, iX].Value = dr["スタッフコード"].ToString().PadLeft(7, '0'); tempGrid[col_Name, iX].Value = dr["スタッフ名"].ToString(); tempGrid[col_sID, iX].Value = dr["派遣先CD"].ToString().PadLeft(8, '0'); tempGrid[col_sName1, iX].Value = dr["派遣先名"].ToString(); tempGrid[col_sName2, iX].Value = dr["派遣先部署"].ToString(); tempGrid[col_Keiyaku, iX].Value = dr["契約期間開始"].ToString() + "~" + dr["契約期間終了"].ToString(); tempGrid[col_WorkTime, iX].Value = dr["開始時刻1"].ToString().PadLeft(5, '0') + "~" + dr["終了時刻1"].ToString().PadLeft(5, '0'); tempGrid[col_OrderCode, iX].Value = dr["オーダーコード"].ToString(); tempGrid[col_TenpoCode, iX].Value = dr["派遣先CD"].ToString(); iX++; } } else if (usr == global.PART_SELECT) { sCom.CommandText = "select * from パートマスタ order by ID"; OleDbDataReader dr = sCom.ExecuteReader(); // マスタ読み込み int iX = 0; tempGrid.RowCount = 0; while (dr.Read()) { tempGrid.Rows.Add(); tempGrid[col_ID, iX].Value = dr["個人番号"].ToString().PadLeft(7, '0'); tempGrid[col_Name, iX].Value = dr["姓"].ToString() + " " + dr["名"].ToString(); tempGrid[col_sID, iX].Value = dr["勤務場所店番"].ToString().PadLeft(5, '0'); tempGrid[col_sName1, iX].Value = dr["勤務場所店名"].ToString(); //DateTime d1 = DateTime.Parse(dr["雇用期間始"].ToString()); // 2019/02/12 コメント化 //string gd1 = d1.ToString("ggyy/MM/dd", culture); // 2019/02/12 コメント化 //DateTime d2 = DateTime.Parse(dr["雇用期間終"].ToString()); // 2019/02/12 コメント化 //string gd2 = d2.ToString("ggyy/MM/dd", culture); // 2019/02/12 コメント化 //tempGrid[col_Keiyaku, iX].Value = gd1 + "~" + gd2; // 2019/02/12 コメント化 tempGrid[col_Keiyaku, iX].Value = dr["雇用期間始"].ToString() + "~" + dr["雇用期間終"].ToString(); DateTime sTime = DateTime.FromOADate(double.Parse(dr["勤務時間始"].ToString())); DateTime eTime = DateTime.FromOADate(double.Parse(dr["勤務時間終"].ToString())); tempGrid[col_WorkTime, iX].Value = sTime.ToShortTimeString().PadLeft(5, '0') + "~" + eTime.ToShortTimeString().PadLeft(5, '0'); iX++; } } tempGrid.CurrentCell = null; }