public static SearchCatalogByTextEntity[] SearchCatalogbyText(SearchCatalogByConditionEntity obj) { List <SearchCatalogByTextEntity> details = new List <SearchCatalogByTextEntity>(); try { details = new GenericDAO().SearchCatalogbyText(obj); } catch (Exception ex) { // details.Add(new DbStatusEntity(ex.Message)); } return(details.ToArray()); }
public List <SearchCatalogByTextEntity> SearchCatalogbyText(SearchCatalogByConditionEntity obj) { string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString; SqlDataAdapter adapter; DataSet ds = new DataSet(); List <SearchCatalogByTextEntity> retlst = new List <SearchCatalogByTextEntity>(); try { using (SqlConnection con = new SqlConnection(CS)) { SqlCommand cmd = new SqlCommand("USP_GetCatalogForSearchDetails", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@SearchBy", obj.SEARCHBY); cmd.Parameters.AddWithValue("@Condition", obj.CONDITION); cmd.Parameters.AddWithValue("@SearchItem", obj.SEARCHITEM); con.Open(); adapter = new SqlDataAdapter(cmd); adapter.Fill(ds); for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++) { SearchCatalogByTextEntity objres = new SearchCatalogByTextEntity(); objres.ID = Convert.ToInt64(ds.Tables[0].Rows[i]["ID"].ToString()); objres.SKU = ds.Tables[0].Rows[i]["SKU"] == DBNull.Value ? "" : ds.Tables[0].Rows[i]["SKU"].ToString(); objres.CODE = ds.Tables[0].Rows[i]["CODE"] == DBNull.Value ? "" : ds.Tables[0].Rows[i]["CODE"].ToString(); objres.TITLE = ds.Tables[0].Rows[i]["TITLE"] == DBNull.Value ? "" : ds.Tables[0].Rows[i]["TITLE"].ToString(); objres.JEWELLERY_NAME = ds.Tables[0].Rows[i]["JEWELLERY_NAME"] == DBNull.Value ? "" : ds.Tables[0].Rows[i]["JEWELLERY_NAME"].ToString(); objres.COLLECTIONS_NAME = ds.Tables[0].Rows[i]["COLLECTIONS_NAME"] == DBNull.Value ? "" : ds.Tables[0].Rows[i]["COLLECTIONS_NAME"].ToString(); objres.DESIGN_NAME = ds.Tables[0].Rows[i]["DESIGN_NAME"] == DBNull.Value ? "" : ds.Tables[0].Rows[i]["DESIGN_NAME"].ToString(); objres.ORG_FILE_NAME = ds.Tables[0].Rows[i]["ORG_FILE_NAME"] == DBNull.Value ? "" : ds.Tables[0].Rows[i]["ORG_FILE_NAME"].ToString(); objres.PHY_FILE_NAME = ds.Tables[0].Rows[i]["PHY_FILE_NAME"] == DBNull.Value ? "" : ds.Tables[0].Rows[i]["PHY_FILE_NAME"].ToString(); objres.PCS = ds.Tables[0].Rows[i]["PCS"] == DBNull.Value ? 1 : Convert.ToInt32(ds.Tables[0].Rows[i]["PCS"]); objres.WT = ds.Tables[0].Rows[i]["WT"] == DBNull.Value ? "" : Convert.ToString(ds.Tables[0].Rows[i]["WT"]); retlst.Add(objres); } } } catch (Exception ex) { throw ex; } return(retlst); }