public DataTable GetRptDatatable(BE_RptClients BE_RptClient, string Rpttype) { DataTable dt = new DataTable(); try { SqlConnection sqlconn = new SqlConnection(ConnString); SqlCommand sqlcomm = new SqlCommand(); sqlcomm.Connection = sqlconn; if (Rpttype == "MemberName") { sqlcomm.CommandText = "RptSearch_ClientName"; sqlcomm.CommandType = CommandType.StoredProcedure; sqlcomm.Parameters.AddWithValue("@ClientName", BE_RptClient.MemberName); dt = GetdataTable(sqlcomm, sqlconn); sqlcomm.Dispose(); } else if (Rpttype == "MemberCode") { sqlcomm.CommandText = "RptSearch_MemberCode"; sqlcomm.CommandType = CommandType.StoredProcedure; sqlcomm.Parameters.AddWithValue("@ClientCode", BE_RptClient.MemberCode); dt = GetdataTable(sqlcomm, sqlconn); sqlcomm.Dispose(); } else if (Rpttype == "NIC") { sqlcomm.CommandText = "RptSearch_NIC"; sqlcomm.CommandType = CommandType.StoredProcedure; sqlcomm.Parameters.AddWithValue("@NIC", BE_RptClient.NIC); dt = GetdataTable(sqlcomm, sqlconn); sqlcomm.Dispose(); } else if (Rpttype == "CellNo") { sqlcomm.CommandText = "RptSearch_CellNo"; sqlcomm.CommandType = CommandType.StoredProcedure; sqlcomm.Parameters.AddWithValue("@CellNo", BE_RptClient.CellNo); dt = GetdataTable(sqlcomm, sqlconn); sqlcomm.Dispose(); } else if (Rpttype == "Limit") { sqlcomm.CommandText = "RptSearch_Limit"; sqlcomm.CommandType = CommandType.StoredProcedure; sqlcomm.Parameters.AddWithValue("@Limit", BE_RptClient.Limit); dt = GetdataTable(sqlcomm, sqlconn); sqlcomm.Dispose(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Easy Rashan Management System", MessageBoxButtons.OK, MessageBoxIcon.Stop); } return(dt); }
public DataTable GetRptDatatable(BE_RptClients BE_RptClient, string Rpttype) { DAL_RptClients NewDALRpt = new DAL_RptClients(); return(NewDALRpt.GetRptDatatable(BE_RptClient, Rpttype)); }