/// <summary> /// ID値から名称の変換 /// </summary> /// <param name="idParam"></param> /// <returns></returns> public static string ToString(int idParam) { LocalDataBaseDataSet dac = Application.Current.Properties["DAC"] as LocalDataBaseDataSet; LocalDataBaseDataSet.LocationMasterRow row = dac.GetLocation(idParam); if (null == row) { return(string.Empty); } return(("En" == (string)Application.Current.Properties["JpEnMode"]) ? row.EName : row.JName); }
private void btnEntry_Click(object sender, RoutedEventArgs e) { int selectLocation = this.cmbLocation.SelectedIndex; if (0 > selectLocation) { MessageBox.Show("場所を選択してください。"); return; } if (null == this._selectedCell) { MessageBox.Show("日付を選択してください。"); return; } LocalDataBaseDataSet.LocationMasterRow locationRow = ((DataRowView)this.cmbLocation.Items[selectLocation]).Row as LocalDataBaseDataSet.LocationMasterRow; DateTime selectDate = new DateTime(this._targetYearMonth.Year, this._targetYearMonth.Month, int.Parse(this._selectedCell.Content.ToString())); string filter = string.Format("LocationID = {0} AND Date = #{1}#", locationRow.LocationID, selectDate); DataRow[] selectRows = this.Dac.ScheduleInfo.Select(filter); if (null != selectRows && 0 != selectRows.Length) { MessageBox.Show("既に登録済です。"); return; } LocalDataBaseDataSet.ScheduleInfoRow row = this.Dac.ScheduleInfo.NewScheduleInfoRow(); row.LocationID = locationRow.LocationID; row.Date = selectDate; row.RestFlg = false; this.Dac.ScheduleInfo.AddScheduleInfoRow(row); this.DialogResult = true; this.Close(); }
private void btnUpdate_Click(object sender, RoutedEventArgs e) { int selectLocation = this.cmbLocation.SelectedIndex; if (0 > selectLocation) { MessageBox.Show("場所を選択してください。"); return; } if (null == this._selectedCell) { MessageBox.Show("日付を選択してください。"); return; } LocalDataBaseDataSet.LocationMasterRow locationRow = ((DataRowView)this.cmbLocation.Items[selectLocation]).Row as LocalDataBaseDataSet.LocationMasterRow; string filter = string.Format("LocationID = {0} AND Date = #{1}#", this._targetSchedule.LocationID, this._targetSchedule.Date); DataRow[] selectRows = this.Dac.ScheduleInfo.Select(filter); if (null == selectRows || 0 == selectRows.Length) { MessageBox.Show("対象データが存在しませんでした。"); return; } LocalDataBaseDataSet.ScheduleInfoRow row = selectRows[0] as LocalDataBaseDataSet.ScheduleInfoRow; row.Date = new DateTime(this._targetYearMonth.Year, this._targetYearMonth.Month, int.Parse(this._selectedCell.Content.ToString())); row.LocationID = locationRow.LocationID; this.DialogResult = true; this.Close(); }