public List <ClientMasterEntity> GetClientList(ClientMasterSearchEntity ob) { string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString; SqlDataAdapter adapter; DataSet ds = new DataSet(); List <ClientMasterEntity> retlst = new List <ClientMasterEntity>(); try { using (SqlConnection con = new SqlConnection(CS)) { SqlCommand cmd = new SqlCommand("USP_GetClientMasterList", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@C_NO", ob.C_NO); cmd.Parameters.AddWithValue("@FILE_NO", ob.FILE_NO); cmd.Parameters.AddWithValue("@C_NAME", ob.C_NAME); cmd.Parameters.AddWithValue("@GENDER", ob.GENDER); cmd.Parameters.AddWithValue("@CITY", ob.CITY); cmd.Parameters.AddWithValue("@STATE", ob.STATE); cmd.Parameters.AddWithValue("@PH_NO", ob.PH_NO); cmd.Parameters.AddWithValue("@MOBILE_NO1", ob.MOBILE_NO1); cmd.Parameters.AddWithValue("@MOBILE_NO2", ob.MOBILE_NO2); cmd.Parameters.AddWithValue("@EMAIL_ID", ob.EMAIL_ID); cmd.Parameters.AddWithValue("@PAN", ob.PAN); cmd.Parameters.AddWithValue("@AADHAAR", ob.AADHAAR); cmd.Parameters.AddWithValue("@GSTIN", ob.GSTIN); cmd.Parameters.AddWithValue("@WARD", ob.WARD); cmd.Parameters.AddWithValue("@RACK_NO", ob.RACK_NO); cmd.Parameters.AddWithValue("@CLI_GRP_LST", ob.CLI_GRP_LST); cmd.Parameters.AddWithValue("@CLI_CAT_LST", ob.CLI_CAT_LST); cmd.Parameters.AddWithValue("@CNT", ob.CNT); con.Open(); adapter = new SqlDataAdapter(cmd); adapter.Fill(ds); for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++) { ClientMasterEntity obj = new ClientMasterEntity(); obj.C_ID = ds.Tables[0].Rows[i]["C_ID"] == DBNull.Value ? 0 : Convert.ToInt64(ds.Tables[0].Rows[i]["C_ID"]); obj.C_NO = ds.Tables[0].Rows[i]["C_NO"] == DBNull.Value ? 0 : Convert.ToInt64(ds.Tables[0].Rows[i]["C_NO"]); obj.FILE_NO = ds.Tables[0].Rows[i]["FILE_NO"] != DBNull.Value ? ds.Tables[0].Rows[i]["FILE_NO"].ToString() : ""; obj.C_NAME = ds.Tables[0].Rows[i]["C_NAME"] != DBNull.Value ? ds.Tables[0].Rows[i]["C_NAME"].ToString() : ""; obj.MOBILE_NO1 = ds.Tables[0].Rows[i]["MOBILE_NO1"] != DBNull.Value ? ds.Tables[0].Rows[i]["MOBILE_NO1"].ToString() : ""; obj.PAN = ds.Tables[0].Rows[i]["PAN"] != DBNull.Value ? ds.Tables[0].Rows[i]["PAN"].ToString() : ""; obj.GSTIN = ds.Tables[0].Rows[i]["GSTIN"] != DBNull.Value ? ds.Tables[0].Rows[i]["GSTIN"].ToString() : ""; obj.ACTIVE_STATUS = Convert.ToBoolean(ds.Tables[0].Rows[i]["ACTIVE_STATUS"]); retlst.Add(obj); } } } catch (Exception ex) { throw ex; } return(retlst); }
public static ClientMasterEntity[] GetData(ClientMasterSearchEntity obj) //Show the details of the data after insert in HTML Table { var details = new List <ClientMasterEntity>(); try { details = new ClientMasterDAO().GetClientList(obj); } catch (Exception ex) { // details.Add(new DbStatusEntity(ex.Message)); } return(details.ToArray()); }