public void ShowPopup(System.Windows.Forms.Form owner, System.Drawing.Point location) { if (popup != null) { popup.Close(); popup = null; } popup = new views.popup.YosanHojoKamokuPopup(); popup.PopupClosed += delegate() { popup = null; gridController = null; yosanHojoKamokuTable = null; }; yosanHojoKamokuTable = new models.db.vtables.UsableYosanHojoKamoku(Context.KaikeiDatabase); gridController = new grid.DBPanelGridController <views.grid.YosanHojoKamokuRow>(popup.Grid, true); gridController.SetTable(yosanHojoKamokuTable); gridController.RowUpdated += (row) => SetSumAmount(); gridController.InitInsertedRow += Grid_InitInsertedRow; gridController.RowDeleted += (row) => SetSumAmount(); gridController.Row_GotFocusAction += (row) => RowSelectionChanged(); gridController.SetQuery(""); popup.StartPosition = System.Windows.Forms.FormStartPosition.Manual; popup.Location = location; popup.Show(owner); }
public void ShowPopup(System.Windows.Forms.Form owner, System.Drawing.Point location) { if (popup != null) { popup.Close(); popup = null; } popup = new views.popup.YosanDaikubunPopup(); /*popup.PopupClosed += delegate() { * popup = null; * gridController = null; * yosanDaikubunTable = null; * };*/ yosanDaikubunTable = new models.db.vtables.UsableYosanDaikubun(Context.KaikeiDatabase); gridController = new grid.DBPanelGridController <views.grid.YosanDaikubunRow>(popup.Grid, false); gridController.SetTable(yosanDaikubunTable); gridController.Row_GotFocusAction += (row) => RowSelectionChanged(); gridController.SetQuery(""); popup.StartPosition = System.Windows.Forms.FormStartPosition.Manual; popup.Location = location; popup.Show(owner); }
public void ShowPopup(System.Windows.Forms.Form owner, System.Drawing.Rectangle pos, string caption, bool daikubun, bool showUsableOnly, bool embedded) { if (popup != null) { popup.Close(); popup = null; } if (daikubun) { popup = new views.popup.YosanKamokuDaikubunPopup(); } else { popup = new views.popup.YosanKamokuKubunPopup(); } popup.FormClosed += delegate(object sender, System.Windows.Forms.FormClosedEventArgs e) { popup = null; gridController = null; }; if (popup is views.popup.YosanKamokuDaikubunPopup) { grid = (popup as views.popup.YosanKamokuDaikubunPopup).Grid as views.grid.PanelGrid <RowType>; } else if (popup is views.popup.YosanKamokuKubunPopup) { grid = (popup as views.popup.YosanKamokuKubunPopup).Grid as views.grid.PanelGrid <RowType>; } bufferedTable = new models.db.vtables.BufferedYosanKamokuKubun(Context.KaikeiDatabase); bufferedTable.UsableOnly = showUsableOnly; gridController = new grid.DBPanelGridController <RowType>(grid, false); gridController.SetTable(bufferedTable); gridController.RowUpdated += (row) => ChangeSumAmount(); gridController.Row_GotFocusAction += (row) => RowSelectionChanged(); //popup.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; //popup.Parent = owner; popup.StartPosition = System.Windows.Forms.FormStartPosition.Manual; popup.Location = pos.Location; popup.Size = pos.Size; popup.Text = caption; popup.Show(owner); stickyWindowController = new misc.StickyWindowController(owner, popup); }
public void ShowPopup(System.Windows.Forms.Form owner) { if (popup != null) { popup.Close(); popup = null; } popup = new views.popup.YosanKakuninPopup(); popup.PopupClosed += delegate() { popup = null; kamokuGridController = null; }; popup.CloseButtonClicked += delegate() { ClosePopup(); }; popup.SearchKamokuButtonClicked += delegate() { SetQueryConditionForKamoku( false, popup.KamokuSearchConditionYear, popup.KamokuSearchConditionKeiriKubun, popup.KamokuSearchConditionYosanKubun); }; popup.SearchHojoButtonClicked += delegate() { SetQueryConditionForHojo( false, popup.HojoSearchConditionYear, popup.HojoSearchConditionKeiriKubun, popup.HojoSearchConditionYosanKubun); }; popup.SetDatabase(Context.KaikeiDatabase); kamokuGridController = new grid.DBPanelGridController <views.grid.YosanKamokuKakuninRow>(popup.KamokuGrid, false); kamokuGridController.SetTable(Context.KaikeiDatabase.YosanKamokuKubun); hojoGridController = new grid.DBPanelGridController <views.grid.YosanHojoKakuninRow>(popup.HojoGrid, false); hojoGridController.SetTable(Context.KaikeiDatabase.YosanKamokuKubun); popup.StartPosition = System.Windows.Forms.FormStartPosition.Manual; popup.Location = new System.Drawing.Point( owner.Location.X + (owner.Size.Width - popup.Size.Width) / 2, owner.Location.Y + (owner.Size.Height - popup.Size.Height) / 2 ); popup.Show(owner); }
public void ShowPopup(System.Windows.Forms.Form owner) { if (popup != null) { popup.Close(); popup = null; } popup = new views.popup.YosanListPopup(); popup.PopupClosed += delegate() { popup = null; gridController = null; }; popup.CloseButtonClicked += delegate() { this.ClosePopup(); }; popup.ShowAllButtonClicked += delegate() { SetQueryCondition(year: -1); }; popup.ShowCurrentYearButtonClicked += delegate() { SetQueryCondition(year: Context.Setting.GetDateTime("nenndo_kisanbi").Value.Year); }; popup.ShowButtonClicked += delegate(object sender) { views.grid.AbstractDBGridRow row = sender as views.grid.AbstractDBGridRow; int nenndo = (int)row.RowData.GetLong("nenndo", 0); int kaikeiKubun = (int)row.RowData.GetLong("kaikei_kubun", 0); int yosanKubun = (int)row.RowData.GetLong("yosan_kubun", 0); int hoseiKaisuu = (int)row.RowData.GetLong("hosei_kaisuu", 0); ShowButtonClicked(nenndo, kaikeiKubun, yosanKubun, hoseiKaisuu); }; gridController = new grid.DBPanelGridController <views.grid.YosanListRow>(popup.Grid, false); gridController.SetTable(Context.KaikeiDatabase.YosanKamokuKubun); SetQueryCondition(year: -1); popup.StartPosition = System.Windows.Forms.FormStartPosition.Manual; popup.Location = new System.Drawing.Point( owner.Location.X + (owner.Size.Width - popup.Size.Width) / 2, owner.Location.Y + (owner.Size.Height - popup.Size.Height) / 2 ); popup.Show(owner); }
public void ShowPopup(System.Windows.Forms.Form owner) { if (popup != null) { popup.Close(); popup = null; } popup = new views.popup.YosanYobihiKakuninPopup(); popup.PopupClosed += delegate() { popup = null; gridController = null; }; gridController = new grid.DBPanelGridController <views.grid.YosanYobihiKakuninRow>(popup.Grid, false); gridController.SetTable(Context.KaikeiDatabase.YosanYobihi); popup.StartPosition = System.Windows.Forms.FormStartPosition.Manual; popup.Location = new System.Drawing.Point( owner.Location.X + (owner.Size.Width - popup.Size.Width) / 2, owner.Location.Y + (owner.Size.Height - popup.Size.Height) / 2 ); popup.Show(owner); }
// selectedKamokuRow=nullの場合は新規作成 public void ShowPopup(System.Windows.Forms.Form owner, models.db.Row selectedKamokuRow, models.db.vtables.BufferedMTKanjouKamoku table) { bufferedKanjouKamokuTable = table; kanjouKamokuRow = CreateKanjouKamokuDetailRow(owner, selectedKamokuRow); if (kanjouKamokuRow == null) { return; } if (popup != null) { popup.Close(); popup = null; } popup = new views.popup.KanjouKamokuDetailPopup(); popup.PopupClosed += delegate() { popup = null; hojoKamokuGridController = null; bufferedHojoKamokuTable = null; }; popup.CloseButtonClicked += delegate() { this.ClosePopup(); }; popup.AddSubButtonClicked += delegate(object sender) { var row = sender as views.grid.HojoKamokuRow; bufferedHojoKamokuTable.Update(row.RowData); models.db.Row rowData = Context.KaikeiDatabase.MTKanjouKamoku.NewRow(); rowData.Set("usable", true); rowData.Set("editable", true); rowData.Set("denpyou_print_target", false); rowData.Set("parent_id", row.RowData.GetLong("id", -1)); rowData.Set("kamoku_code", "" + (bufferedHojoKamokuTable.MaxCode() + 1)); int insertedRowNo = bufferedHojoKamokuTable.InsertChildKamoku(rowData); hojoKamokuGridController.SetQuery(""); hojoKamokuGridController.SetFocus(insertedRowNo, null); }; popup.FormClosing += delegate(object sender, System.Windows.Forms.FormClosingEventArgs e) { Dictionary <string, bool> codeHash = new Dictionary <string, bool>(); int rowCt = 0; foreach (var row in bufferedHojoKamokuTable.Select("")) { string code = row.GetStr("kamoku_code"); if (codeHash.ContainsKey(code)) { helper.MsgBox.Err(KaikeiSystemBody.Properties.Resources.MsgDuplicatedKamokuCode); hojoKamokuGridController.SetFocus(rowCt, "kamoku_code"); e.Cancel = true; return; } codeHash[code] = true; rowCt++; } e.Cancel = false; }; bufferedHojoKamokuTable = new models.db.vtables.BufferedMTKanjouKamoku(Context.KaikeiDatabase); bufferedHojoKamokuTable.RootId = (int)kanjouKamokuRow.GetLong("id", -1); bufferedHojoKamokuTable.Recursive = true; bufferedHojoKamokuTable.SyncRowList(); hojoKamokuGridController = new grid.DBPanelGridController <views.grid.HojoKamokuRow>(popup.Grid, true); hojoKamokuGridController.SetTable(bufferedHojoKamokuTable); hojoKamokuGridController.InitInsertedRow += delegate(models.db.Row row) { row.Set("usable", true); row.Set("editable", true); row.Set("denpyou_print_target", true); row.Set("parent_id", (int)kanjouKamokuRow.GetLong("id", -1)); row.Set("kamoku_code", "" + (bufferedHojoKamokuTable.MaxCode() + 1)); }; hojoKamokuGridController.ValidateColumnValue += delegate(views.grid.HojoKamokuRow row, string column, object value) { if (column == "kamoku") { if (row.RowData.GetLong("shikin_kamoku_kubun_id", -1) != -1) { row.RowData.Set("shikin_kamoku_kubun", value); } if (row.RowData.GetLong("jigyou_kamoku_kubun_id", -1) != -1) { row.RowData.Set("jigyou_kamoku_kubun", value); } if (row.RowData.GetLong("taisyaku_kamoku_kubun_id", -1) != -1) { row.RowData.Set("taisyaku_kamoku_kubun", value); } } }; hojoKamokuGridController.ValidateRemoveRow += delegate(views.grid.HojoKamokuRow row) { if ((row.RowData.Table.OwnerDB as models.db.KaikeiDatabase).KaikeiDenpyouMeisai.IsUsedKanjouKamoku(row.RowData.GetId())) { helper.MsgBox.Err(Properties.Resources.MsgUsedKamokuCanNotDelete); return(false); } return(true); }; hojoKamokuGridController.SetQuery(""); popup.KanjouKamokuDetailRow.SetMasterTables(Context.KaikeiDatabase); popup.KanjouKamokuDetailRow.SetRowData(kanjouKamokuRow, false); popup.KanjouKamokuDetailRow.Column_UpdateValueAction += DetailRowColumn_UpdateValue; popup.KanjouKamokuDetailRow.DeleteButtonClicked += DetailRowDeleteButtonClicked; popup.StartPosition = System.Windows.Forms.FormStartPosition.Manual; popup.Location = new System.Drawing.Point( owner.Location.X + (owner.Size.Width - popup.Size.Width) / 2, owner.Location.Y + (owner.Size.Height - popup.Size.Height) / 2 ); popup.ShowDialog(owner); }
public void ShowPopupModal(Form parent, int rowId) { popup = new views.popup.KoteiShisanDetailPopup(); popup.PopupClosed += delegate() { }; popup.CloseButtonClicked += () => popup.Close(); popup.ColumnValueChanged += ColumnValueChanged; popup.FirstButtonClickekd += () => SelectRow(0); popup.EndButtonClicked += () => SelectRow(RowCount - 1); popup.PrevButtonClicked += () => SelectRow(Math.Max(selectedRowNo - 1, 0)); popup.NextButtonClicked += () => SelectRow(Math.Min(selectedRowNo + 1, RowCount)); popup.NewButtonClicked += () => SelectRow(RowCount); popup.DeleteButtonClicked += delegate() { if (SelectedRowId != -1) { selectedRow.Table.Delete(selectedRow); SelectRow(selectedRowNo); } }; popup.IkkatsuSyoukyakuButtonClicked += delegate() { foreach (var row in Context.KaikeiDatabase.MTKoteiShisan.Select("")) { int id = (int)row.GetLong("id", -1); if (id != -1) { models.KoteiShisanFunc.CreateGenkaSyoukyakuMeisai(Context, id); } } meisaiTable.SyncRowList(); meisaiGridController.SetQuery(""); helper.MsgBox.Info(KaikeiSystemBody.Properties.Resources.MsgSucceeded); }; popup.SyoukyakuButtonClicked += delegate() { if (SelectedRowId != -1) { if (models.KoteiShisanFunc.CreateGenkaSyoukyakuMeisai(Context, SelectedRowId)) { meisaiTable.SyncRowList(); meisaiGridController.SetQuery(""); helper.MsgBox.Info(KaikeiSystemBody.Properties.Resources.MsgSucceeded); } else { helper.MsgBox.Err(KaikeiSystemBody.Properties.Resources.MsgInputDataIncomplete); } } }; popup.DeleteMeisaiButtonClicked += delegate() { if (SelectedRowId != -1) { var res = System.Windows.Forms.MessageBox.Show(KaikeiSystemBody.Properties.Resources.MsgConfirmToDeleteRow, KaikeiSystemBody.Properties.Resources.CaptionConfirm, System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Warning); if (res == System.Windows.Forms.DialogResult.OK) { string sql = "delete from " + models.db.tables.GenkaSyoukyakuMeisai.TABLE_NAME + " where kotei_shisan_bangou = " + SelectedRowId; Context.KaikeiDatabase.ExecuteNonQuery(sql); meisaiTable.SyncRowList(); meisaiGridController.SetQuery(""); } } }; popup.SetDatabase(Context.KaikeiDatabase); popup.StartPosition = System.Windows.Forms.FormStartPosition.Manual; popup.Location = new System.Drawing.Point( Math.Max(parent.Left + (parent.Width - popup.Width) / 2, 0), Math.Max(parent.Top + (parent.Height - popup.Height) / 2, 0)); meisaiTable = new models.db.BufferedTable(Context.KaikeiDatabase.GenkaSyoukyakuMeisai); meisaiGridController = new grid.DBPanelGridController <views.grid.SyoukyakuMeisaiRow>(popup.SyoukyakuMeisaiGrid, true); meisaiGridController.SetTable(meisaiTable); meisaiGridController.InitInsertedRow += delegate(models.db.Row row) { if (SelectedRowId != -1) { row.Table.SetColumnValue(row, "kotei_shisan_bangou", SelectedRowId); } }; foreach (var row in popup.SyoukyakuMeisaiGrid.AllRowControls()) { (row as views.grid.SyoukyakuMeisaiRow).DenpyouHakkouButtonClicked += DenpyouHakkouButtonClicked; } SelectRow(RowId2RowNo(rowId)); focusController = new misc.FocusController(popup); popup.ShowDialog(); }