void frmRibbon_OnItemClicked(string ActionType) { if (ActionType == "Save") { var acc = this.editrow; if (acc.RowId == 0) { acc._CurBalance = 0; acc._PrevBalance = 0; if (acc._Vat == null && acc.AccountTypeEnum >= GLAccountTypes.BalanceSheet && acc._MandatoryTax == VatOptions.Optional) { acc._MandatoryTax = VatOptions.NoVat; } if (!UseVatOperation) { acc._VatOperation = null; } } } else if (ActionType == "Script") { var cwAddScript = new CWAddScript(api, editrow, editrow.CalculationExpression); cwAddScript.Closed += delegate { if (cwAddScript.DialogResult == true) { editrow.CalculationExpression = cwAddScript.txtScript.Text; } }; cwAddScript.Show(); } frmRibbon_BaseActions(ActionType); }
private void localMenu_OnItemClicked(string ActionType) { var selectedItem = dgGLReportLine.SelectedItem as GLReportLineClient; switch (ActionType) { case "AddRow": dgGLReportLine.AddRow(); break; case "CopyRow": dgGLReportLine.CopyRow(); break; case "SaveGrid": dgGLReportLine.SelectedItem = null; dgGLReportLine.SaveData(); break; case "DeleteRow": dgGLReportLine.DeleteRow(); break; case "Script": if (selectedItem == null || !selectedItem._ExpressionSum) { return; } var cwAddScript = new CWAddScript(api, selectedItem, selectedItem.Accounts); cwAddScript.Closed += delegate { if (cwAddScript.DialogResult == true) { dgGLReportLine.SetLoadedRow(selectedItem); selectedItem.Accounts = cwAddScript.txtScript.Text; dgGLReportLine.SetModifiedRow(selectedItem); var currentCol = dgGLReportLine.CurrentColumn; dgGLReportLine.tableView.PostEditor(); dgGLReportLine.CurrentColumn = currentCol; dgGLReportLine.tableView.ShowEditor(); } }; cwAddScript.Show(); break; default: gridRibbon_BaseActions(ActionType); break; } }