public List<GetHotProductViewModels> SaleProducts(int? PageIndex, int? PageSize, ref int TotalRecords) { SqlConnection sqlConnection = new SqlConnection(); sqlConnection.ConnectionString = MyConnectionString1; SqlCommand sqlCommand = new SqlCommand(); sqlCommand.CommandText = "GetNewProductsTypicallyByFilter"; sqlCommand.CommandType = CommandType.StoredProcedure; SqlParameter i_Page_Index = sqlCommand.Parameters.Add("@i_Page_Index", SqlDbType.Int); i_Page_Index.Direction = ParameterDirection.Input; i_Page_Index.Value = PageIndex; SqlParameter i_Page_Count = sqlCommand.Parameters.Add("@i_Page_Count", SqlDbType.Int); i_Page_Count.Direction = ParameterDirection.Input; i_Page_Count.Value = PageSize; SqlParameter Module_Id = sqlCommand.Parameters.Add("@Module_Id", SqlDbType.Int); Module_Id.Direction = ParameterDirection.Input; Module_Id.Value = 5; sqlCommand.Parameters.Add("@o_total_rows", SqlDbType.Int).Direction = ParameterDirection.Output; sqlCommand.Connection = sqlConnection; sqlConnection.Open(); SqlDataReader reader = sqlCommand.ExecuteReader(); List<GetHotProductViewModels> hotProducts = new List<GetHotProductViewModels>(); while (reader.Read()) { GetHotProductViewModels h = new GetHotProductViewModels(); h.QLSP_ID = reader.GetInt32(0); h.tenSanPham = reader.GetString(1); h.hinhAnh = reader.GetString(2); h.giaThamKhao = reader.GetFloat(3); hotProducts.Add(h); } reader.NextResult(); TotalRecords = Convert.ToInt32(sqlCommand.Parameters["@o_total_rows"].Value); return hotProducts; }
public List<GetHotProductViewModels> GetSelectionProducts() { SqlConnection sqlConnection = new SqlConnection(); sqlConnection.ConnectionString = MyConnectionString1; SqlCommand sqlCommand = new SqlCommand(); sqlCommand.CommandText = "GetModuleProductsAuto"; sqlCommand.CommandType = CommandType.StoredProcedure; SqlParameter Module_Id = sqlCommand.Parameters.Add("@Module_Id", SqlDbType.Int); Module_Id.Direction = ParameterDirection.Input; Module_Id.Value = 2; sqlCommand.Connection = sqlConnection; sqlConnection.Open(); SqlDataReader reader = sqlCommand.ExecuteReader(); List<GetHotProductViewModels> hotProducts = new List<GetHotProductViewModels>(); while (reader.Read()) { GetHotProductViewModels h = new GetHotProductViewModels(); h.QLSP_ID = reader.GetInt32(0); h.tenSanPham = reader.GetString(1); h.hinhAnh = reader.GetString(2); hotProducts.Add(h); } return hotProducts; }
public List<GetHotProductViewModels> GetShowedAdd() { HtmlHelperGeneral.openConnection(); SqlCommand sqlCommand = new SqlCommand(); sqlCommand.CommandText = "GetShowedAdd"; sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Connection = HtmlHelperGeneral.con; SqlDataReader reader = sqlCommand.ExecuteReader(); List<GetHotProductViewModels> hotProducts = new List<GetHotProductViewModels>(); while (reader.Read()) { GetHotProductViewModels h = new GetHotProductViewModels(); h.QLSP_ID = reader.GetInt32NullCheck(0); h.hinhAnh = reader.GetStringNullCheck(1); h.tenSanPham = reader.GetStringNullCheck(2); hotProducts.Add(h); } HtmlHelperGeneral.Close(); return hotProducts; }
public List<GetHotProductViewModels> GetAdvertisers() { HtmlHelperGeneral.openConnection(); SqlCommand sqlCommand = new SqlCommand(); sqlCommand.CommandText = "GetModuleProductsAuto"; sqlCommand.CommandType = CommandType.StoredProcedure; SqlParameter Module_Id = sqlCommand.Parameters.Add("@Module_Id", SqlDbType.Int); Module_Id.Direction = ParameterDirection.Input; Module_Id.Value = 6; sqlCommand.Connection = HtmlHelperGeneral.con; SqlDataReader reader = sqlCommand.ExecuteReader(); List<GetHotProductViewModels> hotProducts = new List<GetHotProductViewModels>(); while (reader.Read()) { GetHotProductViewModels h = new GetHotProductViewModels(); h.QLSP_ID = reader.GetInt32NullCheck(0); h.tenSanPham = reader.GetStringNullCheck(1); h.hinhAnh = reader.GetStringNullCheck(2); h.AccountId = reader.GetInt32NullCheck(3); hotProducts.Add(h); } HtmlHelperGeneral.Close(); return hotProducts; }
public List<GetHotProductViewModels> GetNewProductsUp(int? PageIndex, int? PageSize, ref int TotalRecords) { HtmlHelperGeneral.openConnection(); SqlCommand sqlCommand = new SqlCommand(); sqlCommand.CommandText = "GetNewProductsTypicallyByFilter"; sqlCommand.CommandType = CommandType.StoredProcedure; SqlParameter i_Page_Index = sqlCommand.Parameters.Add("@i_Page_Index", SqlDbType.Int); i_Page_Index.Direction = ParameterDirection.Input; i_Page_Index.Value = PageIndex; SqlParameter i_Page_Count = sqlCommand.Parameters.Add("@i_Page_Count", SqlDbType.Int); i_Page_Count.Direction = ParameterDirection.Input; i_Page_Count.Value = PageSize; SqlParameter Module_Id = sqlCommand.Parameters.Add("@Module_Id", SqlDbType.Int); Module_Id.Direction = ParameterDirection.Input; Module_Id.Value = 4; sqlCommand.Parameters.Add("@o_total_rows", SqlDbType.Int).Direction = ParameterDirection.Output; sqlCommand.Connection = HtmlHelperGeneral.con; SqlDataReader reader = sqlCommand.ExecuteReader(); List<GetHotProductViewModels> hotProducts = new List<GetHotProductViewModels>(); while (reader.Read()) { GetHotProductViewModels h = new GetHotProductViewModels(); h.QLSP_ID = reader.GetInt32NullCheck(0); h.tenSanPham = reader.GetStringNullCheck(1); h.hinhAnh = reader.GetStringNullCheck(2); h.giaThamKhao = reader.GetFloatNullCheck(3); h.AccountId = reader.GetInt32NullCheck(4); h.DiemNoiBat = reader.GetStringNullCheck(5); hotProducts.Add(h); } reader.NextResult(); TotalRecords = Convert.ToInt32(sqlCommand.Parameters["@o_total_rows"].Value); HtmlHelperGeneral.Close(); return hotProducts; }