public void PopulateProductBrand()
{
try
{
string query = "SELECT * FROM ProductBrand";
SqlCommand cmd = new SqlCommand(query, ConMangalya);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
strBrand += @" ";
}
}
}
catch (Exception ex)
{
}
}
public void PopulateProductSize()
{
try
{
string query = "SELECT * FROM ProductSize";
SqlCommand cmd = new SqlCommand(query, ConMangalya);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
strSize += @" ";
}
}
}
catch (Exception ex)
{
}
}
public void PopulateProductColor()
{
try
{
string query = "SELECT * FROM ProductColor";
SqlCommand cmd = new SqlCommand(query, ConMangalya);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
strColor += @"";
}
}
}
catch (Exception ex)
{
}
}
public void PopulatePriceRange()
{
try
{
string query = "SELECT * FROM ProductPrice";
SqlCommand cmd = new SqlCommand(query, ConMangalya);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
strPrice += @" ";
}
}
}
catch (Exception ex)
{
}
}
[WebMethod]
public static string PopulateProducts(string Data)
{
SqlConnection ConMangalya = new SqlConnection(ConfigurationManager.ConnectionStrings["ConMangalya"].ConnectionString);
string products = "";
string c = "";
string Sc = "";
string sh = "";
try
{
string query = "Select * from AddProduct Where SubCatUrl=@SubCatUrl OR ProductBrand=@ProductBrand OR Color=@Color OR Size=@Size OR PriceRange=@PriceRange";
SqlCommand cmd = new SqlCommand(query, ConMangalya);
cmd.Parameters.AddWithValue("@SubCatUrl", SqlDbType.VarChar).Value = Data;
cmd.Parameters.AddWithValue("@ProductBrand", SqlDbType.VarChar).Value = Data;
cmd.Parameters.AddWithValue("@Color", SqlDbType.VarChar).Value = Data;
cmd.Parameters.AddWithValue("@Size", SqlDbType.VarChar).Value = Data;
cmd.Parameters.AddWithValue("@PriceRange", SqlDbType.VarChar).Value = Data;
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
c= dr["Category"].ToString();
sh= dr["Shop"].ToString(); ;
Sc= dr["SubCat"].ToString();
string strImg = dr["SmallImage"].ToString();
string[] strImg_arr = strImg.Split(',');
string strRating = "";
int rating = Convert.ToInt32(dr["ProductRating"]);
for (int i = 1; i <= rating; i++)
{
strRating += @"";
}
products += @"
}
}
}
catch (Exception ex)
{
}
return products + ',' + c + ',' + sh + ',' + Sc;
}
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Laxmidhar SahooPosted Aug 5, 2020, 4:41 AM