public void TableButton_Click(object sender, EventArgs e) { ClearControls(customProperties.Form); SqlParameter[] _Params = new SqlParameter[2]; _Params[0] = new SqlParameter("IsBilled", "0"); _Params[1] = new SqlParameter("TableSetupID", ((Button)sender).Tag); DataSet ds = SQLHelper.ExecuteQueryReturnDS(CommandType.StoredProcedure, "spGetAll_Sale", _Params); FormPresentationBLL.SetReturnTable(ds.Tables[0]); if (ds.Tables[0].Rows.Count > 0) { FindAndReplaceText(customProperties.Form); BindDetail(); } if (customProperties.AfterTableButtonClick != null) { var type = customProperties.Form.GetType(); MethodInfo theMethod = type.GetMethod(customProperties.AfterTableButtonClick); object[] parametersArray = new object[] { sender }; theMethod.Invoke(customProperties.Form, parametersArray); } }
private void lstSearch_DoubleClick(object sender, EventArgs e) { DataTable dtReturn = new DataTable(); foreach (ColumnHeader lstCol in lstSearch.Columns) { dtReturn.Columns.Add(lstCol.Text); } //foreach (ListViewItem item in lstSearch.FocusedItem) //{ DataRow row = dtReturn.NewRow(); for (int i = 0; i < lstSearch.FocusedItem.SubItems.Count; i++) { row[i] = lstSearch.FocusedItem.SubItems[i].Text; } dtReturn.Rows.Add(row); //} dtReturn.AcceptChanges(); FormPresentationBLL.SetReturnTable(dtReturn); this.DialogResult = DialogResult.OK; this.Close(); if (_colreturn != null) { if (_colreturn.Length > 0) { int index = 0; this.RetVal = new string[_colreturn.Length]; try { foreach (int rCol in _colreturn) { RetVal[index] = lstSearch.FocusedItem.SubItems[rCol].Text; index++; } this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { this.DialogResult = DialogResult.Cancel; this.Close(); } } } }