/// <summary> /// スケジュール削除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ScheduleDelete_Click(object sender, RoutedEventArgs e) { int selectScheduleIndex = this.lsvSchedule.SelectedIndex; if (0 > selectScheduleIndex || selectScheduleIndex >= this.lsvSchedule.Items.Count) { return; } //スケジュール LocalDataBaseDataSet.ScheduleInfoRow scheduleRow = this.lsvSchedule.Items[selectScheduleIndex] as LocalDataBaseDataSet.ScheduleInfoRow; var dlg = new ScheduleEntryDialog(scheduleRow, false) { Owner = this, WindowStartupLocation = WindowStartupLocation.CenterOwner, }; bool?result = dlg.ShowDialog(); if (null != result && true == result) { this.Dac.ScheduleInfo.AcceptChanges(); this.ReloadSchedule(); } }
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(); }
/// <summary> /// メンバリストで選択された行を取得 /// </summary> /// <returns></returns> private LocalDataBaseDataSet.WorkingManagementRow SelectedWorkingMemberRow() { int selectMemberIndex = this.lsvMember.SelectedIndex; int selectScheduleIndex = this.lsvSchedule.SelectedIndex; if (0 > selectScheduleIndex || selectScheduleIndex >= this.lsvSchedule.Items.Count || 0 > selectMemberIndex || selectMemberIndex >= this.lsvMember.Items.Count) { return(null); } //スケジュール LocalDataBaseDataSet.ScheduleInfoRow scheduleRow = this.lsvSchedule.Items[selectScheduleIndex] as LocalDataBaseDataSet.ScheduleInfoRow; //メンバー LocalDataBaseDataSet.WorkingMemberRow memberRow = ((DataRowView)this.lsvMember.Items[selectMemberIndex]).Row as LocalDataBaseDataSet.WorkingMemberRow; string filter = string.Format("WorkingNo = {0} AND MemberID = {1}", scheduleRow.WorkingNo, memberRow.MemberID); DataRow[] selectRows = this.Dac.WorkingManagement.Select(filter); LocalDataBaseDataSet.WorkingManagementRow rtnRow = null; if (null != selectRows && 0 != selectRows.Length) { rtnRow = selectRows[0] as LocalDataBaseDataSet.WorkingManagementRow; } else { rtnRow = this.Dac.WorkingManagement.NewWorkingManagementRow(); rtnRow.WorkingNo = scheduleRow.WorkingNo; rtnRow.MemberID = memberRow.MemberID; rtnRow.WorkKbn = 0; rtnRow.IsGotMoney = false; this.Dac.WorkingManagement.AddWorkingManagementRow(rtnRow); } return(rtnRow); }
/// <summary> /// メンバリストの再読込 /// </summary> private void ReloadMember() { int selectIndex = this.lsvSchedule.SelectedIndex; LocalDataBaseDataSet.ScheduleInfoRow row = null; //メンバービュー if (0 > selectIndex || selectIndex >= this.lsvSchedule.Items.Count) { this.lsvMember.ItemsSource = null; } else { row = this.lsvSchedule.Items[selectIndex] as LocalDataBaseDataSet.ScheduleInfoRow; this.lsvMember.ItemsSource = this.Dac.GetWorkingMemberByWorkingNo(row.WorkingNo, this.DispRetireMemberMode); } this.WriteStatusBarContent((null == row || row.IsLocationIDNull()) ? 0 : row.LocationID); }
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(); }
/// <summary> /// コンストラクタ /// </summary> /// <param name="memberInfoParam"></param> /// <param name="scheduleInfoParam"></param> public GotEquipDialog(LocalDataBaseDataSet.WorkingMemberRow memberInfoParam, LocalDataBaseDataSet.ScheduleInfoRow scheduleInfoParam) { this.InitializeComponent(); this._memberID = memberInfoParam.MemberID; this._locationID = scheduleInfoParam.LocationID; this._workingNo = scheduleInfoParam.WorkingNo; if ("Jp" == this.JpEnMode) { this.lblBui.Content = "取得部位 :"; } else { this.lblBui.Content = "Job And Parts :"; } this.SetJobPartsComboBox(); }
/// <summary> /// コンストラクタ /// </summary> /// <param name="scheduleInfoRowParam"></param> public ScheduleEntryDialog(LocalDataBaseDataSet.ScheduleInfoRow scheduleInfoRowParam, bool isUpdatePram) { this.InitializeComponent(); if (null != scheduleInfoRowParam) { this._targetSchedule = scheduleInfoRowParam; this._isUpdateParam = isUpdatePram; this._targetYearMonth = new DateTime(scheduleInfoRowParam.Date.Year, scheduleInfoRowParam.Date.Month, 1); } this.ShowCalendar(); this.cmbLocation.ItemsSource = this.Dac.LocationMaster; if (null != scheduleInfoRowParam) { if (isUpdatePram) { this.btnOK.Content = "Update"; this.btnOK.Click += this.btnUpdate_Click; } else { this.btnOK.Content = "Delete"; this.btnOK.Click += this.btnDelete_Click; } this.cmbLocation.SelectedIndex = scheduleInfoRowParam.LocationID - 1; this.cmbLocation.IsEnabled = isUpdatePram; } else { this.btnOK.Content = "Entry"; this.btnOK.Click += this.btnEntry_Click; } }
private void btnDelete_Click(object sender, RoutedEventArgs e) { 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.Delete(); this.DialogResult = true; this.Close(); }
/// <summary> /// 取得部位編集ウィンドウのモーダル表示 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GotEquipEdit_Click(object sender, RoutedEventArgs e) { int selectMemberIndex = this.lsvMember.SelectedIndex; int selectScheduleIndex = this.lsvSchedule.SelectedIndex; if (0 > selectScheduleIndex || selectScheduleIndex >= this.lsvSchedule.Items.Count || 0 > selectMemberIndex || selectMemberIndex >= this.lsvMember.Items.Count) { return; } //スケジュール LocalDataBaseDataSet.ScheduleInfoRow scheduleRow = this.lsvSchedule.Items[selectScheduleIndex] as LocalDataBaseDataSet.ScheduleInfoRow; //メンバー LocalDataBaseDataSet.WorkingMemberRow memberRow = ((DataRowView)this.lsvMember.Items[selectMemberIndex]).Row as LocalDataBaseDataSet.WorkingMemberRow; var dlg = new GotEquipDialog(memberRow, scheduleRow) { Owner = this, WindowStartupLocation = WindowStartupLocation.CenterOwner, }; bool?result = dlg.ShowDialog(); if (null != result && true == result) { this.Dac.GotEquipInfo.AcceptChanges(); this.ReloadMember(); } }
/// <summary> /// クリップボードにコピー /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CopyToClipboard_Click(object sender, RoutedEventArgs e) { int selectScheduleIndex = this.lsvSchedule.SelectedIndex; if (0 > selectScheduleIndex || selectScheduleIndex >= this.lsvSchedule.Items.Count) { return; } //スケジュール LocalDataBaseDataSet.ScheduleInfoRow scheduleRow = this.lsvSchedule.Items[selectScheduleIndex] as LocalDataBaseDataSet.ScheduleInfoRow; //対象日の参加メンバーを取得する LocalDataBaseDataSet.WorkingMemberDataTable wkMbrTbl = this.Dac.GetWorkingMemberByWorkingNo(scheduleRow.WorkingNo, false); //クリップボード書出し用 StringBuilder sb = new StringBuilder(); StringBuilder equipContent = new StringBuilder(); StringBuilder moneyContent = new StringBuilder(); StringBuilder memberContent = new StringBuilder(); int workCount = 0; int vacationCount = 0; string hr = "--------------------------------------------------"; //全体 sb.Append("ドロップ内容").Append(Environment.NewLine).Append(Environment.NewLine); //AF取得者 equipContent.Append(hr).Append(Environment.NewLine); equipContent.Append("AF取得者").Append(Environment.NewLine); equipContent.Append(hr).Append(Environment.NewLine); //100貨幣取得者 moneyContent.Append(hr).Append(Environment.NewLine); moneyContent.Append("100貨幣取得者").Append(Environment.NewLine); moneyContent.Append(hr).Append(Environment.NewLine); //参加メンバー memberContent.Append(hr).Append(Environment.NewLine); memberContent.Append("参加メンバー").Append(Environment.NewLine); memberContent.Append(hr).Append(Environment.NewLine); foreach (LocalDataBaseDataSet.WorkingMemberRow wkMbrRow in wkMbrTbl.Select("", "Name")) { //AF LocalDataBaseDataSet.GotEquipInfoDataTable tbl = this.Dac.GetGotEquipInfoByLocationIdMemberId(scheduleRow.WorkingNo, wkMbrRow.MemberID); if (null != tbl) { //名前 equipContent.Append(wkMbrRow.Name); equipContent.Append(":"); //取得部位 for (int index = 0; index < tbl.Count; index++) { LocalDataBaseDataSet.GotEquipInfoRow equipRow = tbl[index]; equipContent.Append(this.Dac.GetJob(equipRow.JobID).JName); equipContent.Append(this.Dac.GetParts(equipRow.PartsID).JName); if (index != tbl.Count - 1) { equipContent.Append("、"); } } equipContent.Append(Environment.NewLine); } LocalDataBaseDataSet.WorkingManagementRow wkMngRow = this.Dac.GetWorkingManagementRow(scheduleRow.WorkingNo, wkMbrRow.MemberID); //100 if (null != wkMngRow && wkMngRow.IsGotMoney) { moneyContent.Append(wkMbrRow.Name); moneyContent.Append(Environment.NewLine); } //出欠 if (null != wkMngRow) { memberContent.Append("○").Append(" "); workCount++; } else { memberContent.Append("×").Append(" "); vacationCount++; } memberContent.Append(wkMbrRow.Name); memberContent.Append(Environment.NewLine); } sb.Append(equipContent.ToString()).Append(Environment.NewLine); sb.Append(moneyContent.ToString()).Append(Environment.NewLine); sb.Append(memberContent.ToString()).Append(Environment.NewLine); //21名出席/8名欠席 sb.Append(string.Format("{0}名出席/{1}名欠席", workCount, vacationCount)); //クリップボードに書き出す Clipboard.Clear(); Clipboard.SetText(sb.ToString()); }