private void button_Click(object sender, EventArgs e) { Button btn = ( Button )sender; if (btn.Name == "buttonClose") { this.Close(); return; } if (btn.Name == "buttonStoreMWorkItems") { if (formImpMWorkItems == null || formImpMWorkItems.IsDisposed) { formImpMWorkItems = new FormImpMWorkItems(hp); formImpMWorkItems.Show(); } else { MessageBox.Show(msgAlready); } return; } TaskEntryData itd = new TaskEntryData(); if (btn.Name == "buttonAdd") { //itd.OfficeCode = Convert.ToString( comboBoxOffice.SelectedValue ); //itd.Department = Convert.ToString( comboBoxDepartment.SelectedValue ); //itd.OfficeName = comboBoxOffice.Text; //itd.DepartName = comboBoxDepartment.Text; //labelTaskEntryID.Text = ""; } else { if (labelTaskEntryID.Text == "" || labelTaskEntryID.Text == "0") { DMessage.DataNotEnough(); return; } itd = itd.SelectTaskEntryData(Convert.ToInt32(labelTaskEntryID.Text)); itd.MemberCode = hp.MemberCode; itd.TaxRate = hp.TaxRate; itd.AdminCostRate = hp.AdminCostRate; itd.OthersCostRate = hp.OthersCostRate; itd.Expenses = hp.Expenses; itd.OfficeCode = Conv.OfficeCode; itd.Department = Conv.DepartCode; itd.PartnerName = labelPartner.Text; } switch (btn.Name) { case "buttonEstimate": formEstimate = new FormEstimate(itd); formEstimate.Show(); break; case "buttonPlanning": formPlanning = new FormPlanning(itd); formPlanning.Show(); break; case "buttonOsDetail": formOutsource = new FormOutsource(itd); formOutsource.Show(); break; case "buttonContract": formContract = new FormContract(itd); formContract.Show(); break; case "buttonRegular": formRegular = new FormRegular(itd); formRegular.Show(); break; case "buttonVolumeInvoice": formVolumeInvoice = new FormVolumeInvoice(itd); formVolumeInvoice.Show(); break; case "buttonInvoice": formInvoice = new FormInvoice(itd); formInvoice.Show(); break; //case "buttonDetail": // displayDetailLabel(ted); // break; case "buttonAdd": itd.OfficeCode = Conv.OfficeCode; itd.Department = Conv.DepartCode; itd.OfficeName = Conv.Office; itd.DepartName = Conv.Depart; labelTaskEntryID.Text = ""; itd = FormTaskEntry.DispData(itd); displayDetailLabel(itd); comboBoxCostType.Text = itd.CostType; textBoxTaskName.Text = itd.TaskName; labelPartner.Text = itd.PartnerName; labelTaskPlace.Text = itd.TaskPlace; labelTaskCode.Text = itd.TaskCode; labelTaskEntryID.Text = Convert.ToString(itd.TaskEntryID); // ? 仮版 : 正式版 labelTaskName.Text = (labelTaskCode.Text.Trim() == "") ? "": itd.TaskName; ListFormDataOp lo = new ListFormDataOp(); etcd = lo.SelectTaskEntryNameData(itd.OfficeCode, itd.Department, null); buttonTask.Enabled = string.IsNullOrEmpty(labelTaskCode.Text.Trim()) ? true : false; buttonTask.Visible = string.IsNullOrEmpty(labelTaskCode.Text.Trim()) ? true : false; break; case "buttonTask": if (String.IsNullOrEmpty(textBoxTaskName.Text)) { MessageBox.Show("対応する見積・計画用業務名がありません"); return; } tcds = FormTaskCodeNameList.ReceiveItems(tcd); if (!writeTaskCodeToTaskEntryData()) { return; } if (!displayTaskData(tcds)) { return; } break; default: break; } }
private void button_Click(object sender, EventArgs e) { Button btn = (Button)sender; switch (btn.Name) { case "buttonExpCostData": if (formExpCostData == null || formExpCostData.IsDisposed) { formExpCostData = new FormExpCostData(hp); formExpCostData.Show(); } else { MessageBox.Show(msgAlready); } break; case "buttonStoreMOffice": if (formImpMOffice == null || formImpMOffice.IsDisposed) { formImpMOffice = new FormImpMOffice(); formImpMOffice.Show(); } else { MessageBox.Show(msgAlready); } break; case "buttonStoreMCost": if (formImpMCost == null || formImpMCost.IsDisposed) { formImpMCost = new FormImpMCost(); formImpMCost.Show(); } else { MessageBox.Show(msgAlready); } break; case "buttonStoreMWorkItems": if (formImpMWorkItems == null || formImpMWorkItems.IsDisposed) { formImpMWorkItems = new FormImpMWorkItems(hp); formImpMWorkItems.Show(); } else { MessageBox.Show(msgAlready); } break; case "buttonStoreMCalendar": if (formImpMCalendar == null || formImpMCalendar.IsDisposed) { formImpMCalendar = new FormImpMCalendar(); formImpMCalendar.Show(); } else { MessageBox.Show(msgAlready); } break; case "buttonStoreMCommon": if (formImpMCommon == null || formImpMCommon.IsDisposed) { formImpMCommon = new FormImpMCommon(); formImpMCommon.Show(); } else { MessageBox.Show(msgAlready); } break; case "buttonStoreMMembers": if (formImpMMembers == null || formImpMMembers.IsDisposed) { formImpMMembers = new FormImpMMembers(); formImpMMembers.Show(); } else { MessageBox.Show(msgAlready); } break; case "buttonStoreMPartners": if (formImpMPartners == null || formImpMPartners.IsDisposed) { formImpMPartners = new FormImpMPartners(); formImpMPartners.Show(); } else { MessageBox.Show(msgAlready); } break; case "buttonStoreTaskData": if (formImpTaskData == null || formImpTaskData.IsDisposed) { formImpTaskData = new FormImpTaskData(); formImpTaskData.Show(); } else { MessageBox.Show(msgAlready); } break; case "buttonClosing": if (formClosingProc == null || formClosingProc.IsDisposed) { formClosingProc = new FormClosingProc(); formClosingProc.Show(); } else { MessageBox.Show(msgAlready); } break; case "buttonMntDBBackup": System.Diagnostics.Process.Start(@"c:\CostVolumeSys\Backup\Backup.bat"); break; case "buttonMntGenData": if (formImpGenData == null || formImpGenData.IsDisposed) { formImpGenData = new FormImpGenData(); formImpGenData.Show(); } else { MessageBox.Show(msgAlready); } break; case "buttonAuth": if (formImpAuthority == null || formImpAuthority.IsDisposed) { formImpAuthority = new FormImpAuthority(); formImpAuthority.Show(); } else { MessageBox.Show(msgAlready); } break; case "buttonMntVolume": if (formImpLedger == null || formImpLedger.IsDisposed) { formImpLedger = new FormImpLedger(); formImpLedger.Show(); } else { MessageBox.Show(msgAlready); } break; case "buttonTaskChange": if (formTaskChange == null || formTaskChange.IsDisposed) { formTaskChange = new FormTaskChange(hp); formTaskChange.Show(); } else { MessageBox.Show(msgAlready); } break; case "buttonMCostMnt": if (formMCostMnt == null || formMCostMnt.IsDisposed) { formMCostMnt = new FormMCostMnt(); formMCostMnt.Show(); } else { MessageBox.Show(msgAlready); } break; case "buttonStart": break; case "buttonCancel": break; default: break; } }