public IList <UsedCarsInfo> FilterSearch(CarsInfo.CarsFilter objCarsFilter) { string spNameString = string.Empty; //Setting Connection //Global.INSTANCE_NAME = strCurrentConn; IDataReader ModelsInfoDataReader = null; IList <UsedCarsInfo> UsedCarsIList = new List <UsedCarsInfo>(); //Connect to the database Database dbDatabase = DatabaseFactory.CreateDatabase(Global.INSTANCE_NAME); //Assign stored procedure name spNameString = "[FilterSearch]"; DbCommand dbCommand = null; IDataReader UsedCarsDataReader = null; try { //Set stored procedure to the command object dbCommand = dbDatabase.GetStoredProcCommand(spNameString); dbCommand.CommandTimeout = 10000; dbDatabase.AddInParameter(dbCommand, "@makeModelID", DbType.String, objCarsFilter.CarModalId); dbDatabase.AddInParameter(dbCommand, "@Nearby", DbType.String, objCarsFilter.WithinZip); dbDatabase.AddInParameter(dbCommand, "@Pin", DbType.Int64, objCarsFilter.ZipCode); dbDatabase.AddInParameter(dbCommand, "@currentPage", DbType.Int64, objCarsFilter.CurrentPage); dbDatabase.AddInParameter(dbCommand, "@makeID", DbType.String, objCarsFilter.CarMakeid); dbDatabase.AddInParameter(dbCommand, "@Orderby", DbType.String, objCarsFilter.Orderby); dbDatabase.AddInParameter(dbCommand, "@sort", DbType.String, objCarsFilter.Sort); dbDatabase.AddInParameter(dbCommand, "@pageSize", DbType.Int64, objCarsFilter.PageSize); dbDatabase.AddInParameter(dbCommand, "@Mileage1", DbType.String, objCarsFilter.Mileage1); dbDatabase.AddInParameter(dbCommand, "@Mileage2", DbType.String, objCarsFilter.Mileage2); dbDatabase.AddInParameter(dbCommand, "@Mileage3", DbType.String, objCarsFilter.Mileage3); dbDatabase.AddInParameter(dbCommand, "@Mileage4", DbType.String, objCarsFilter.Mileage4); dbDatabase.AddInParameter(dbCommand, "@Mileage5", DbType.String, objCarsFilter.Mileage5); dbDatabase.AddInParameter(dbCommand, "@Mileage6", DbType.String, objCarsFilter.Mileage6); dbDatabase.AddInParameter(dbCommand, "@Mileage7", DbType.String, objCarsFilter.Mileage7); dbDatabase.AddInParameter(dbCommand, "@Year1a", DbType.String, objCarsFilter.Year1a); dbDatabase.AddInParameter(dbCommand, "@Year1b", DbType.String, objCarsFilter.Year1b); dbDatabase.AddInParameter(dbCommand, "@Year1", DbType.String, objCarsFilter.Year1); dbDatabase.AddInParameter(dbCommand, "@Year2", DbType.String, objCarsFilter.Year2); dbDatabase.AddInParameter(dbCommand, "@Year3", DbType.String, objCarsFilter.Year3); dbDatabase.AddInParameter(dbCommand, "@Year4", DbType.String, objCarsFilter.Year4); dbDatabase.AddInParameter(dbCommand, "@Year5", DbType.String, objCarsFilter.Year5); dbDatabase.AddInParameter(dbCommand, "@Year6", DbType.String, objCarsFilter.Year6); dbDatabase.AddInParameter(dbCommand, "@Year7", DbType.String, objCarsFilter.Year7); dbDatabase.AddInParameter(dbCommand, "@Price1", DbType.String, objCarsFilter.Price1); dbDatabase.AddInParameter(dbCommand, "@Price2", DbType.String, objCarsFilter.Price2); dbDatabase.AddInParameter(dbCommand, "@Price3", DbType.String, objCarsFilter.Price3); dbDatabase.AddInParameter(dbCommand, "@Price4", DbType.String, objCarsFilter.Price4); dbDatabase.AddInParameter(dbCommand, "@Price5", DbType.String, objCarsFilter.Price5); dbDatabase.AddInParameter(dbCommand, "@Body1", DbType.String, objCarsFilter.Body1); dbDatabase.AddInParameter(dbCommand, "@Body2", DbType.String, objCarsFilter.Body2); dbDatabase.AddInParameter(dbCommand, "@Body3", DbType.String, objCarsFilter.Body3); dbDatabase.AddInParameter(dbCommand, "@Body4", DbType.String, objCarsFilter.Body4); dbDatabase.AddInParameter(dbCommand, "@Body5", DbType.String, objCarsFilter.Body5); dbDatabase.AddInParameter(dbCommand, "@Body6", DbType.String, objCarsFilter.Body6); dbDatabase.AddInParameter(dbCommand, "@Body7", DbType.String, objCarsFilter.Body7); dbDatabase.AddInParameter(dbCommand, "@Body8", DbType.String, objCarsFilter.Body8); dbDatabase.AddInParameter(dbCommand, "@Body9", DbType.String, objCarsFilter.Body9); dbDatabase.AddInParameter(dbCommand, "@Fuel1", DbType.String, objCarsFilter.Fuel1); dbDatabase.AddInParameter(dbCommand, "@Fuel2", DbType.String, objCarsFilter.Fuel2); dbDatabase.AddInParameter(dbCommand, "@Fuel3", DbType.String, objCarsFilter.Fuel3); dbDatabase.AddInParameter(dbCommand, "@Fuel4", DbType.String, objCarsFilter.Fuel4); dbDatabase.AddInParameter(dbCommand, "@Fuel5", DbType.String, objCarsFilter.Fuel5); dbDatabase.AddInParameter(dbCommand, "@Seller1", DbType.String, objCarsFilter.Seller1); dbDatabase.AddInParameter(dbCommand, "@Seller2", DbType.String, objCarsFilter.Seller2); dbDatabase.AddInParameter(dbCommand, "@withPic", DbType.Boolean, objCarsFilter.WithPic); //objUsedCars.Executing stored procedure UsedCarsDataReader = dbDatabase.ExecuteReader(dbCommand); //'DataSet DS = dbDatabase.ExecuteDataSet(dbCommand); while (UsedCarsDataReader.Read()) { // objUsedCars.Assign values to the CarsInfo object list UsedCarsInfo ObjCarsInfo_Info = new UsedCarsInfo(); AssignCarsInfoList(UsedCarsDataReader, ObjCarsInfo_Info); UsedCarsIList.Add(ObjCarsInfo_Info); } } catch (Exception ex) { bool rethrow = ExceptionPolicy.HandleException(ex, Global.EXCEPTION_POLICY); if (rethrow) { throw; } } finally { UsedCarsDataReader.Close(); } return(UsedCarsIList); }
public List<CarsInfo.UsedCarsInfo> GetCarsFilterAndroidMobile(string carMake, string CarModal, string Mileage, string Year, string Price, string Sort, string Orderby, string pageSize, string CurrentPage, string Zipcode, string AuthenticationID, string CustomerID) { CarsFilter objCarsFilter = new CarsFilter(); Filter objFilter = new Filter(); List<CarsInfo.UsedCarsInfo> objFilterdata = new List<CarsInfo.UsedCarsInfo>(); CarsInfo.UsedCarsInfo OBJ = new CarsInfo.UsedCarsInfo(); string sort = string.Empty; objCarsFilter.CurrentPage = CurrentPage; objCarsFilter.PageSize = pageSize; objCarsFilter.CarMakeid = carMake; objCarsFilter.CarModalId = CarModal; objCarsFilter.Sort = Sort; objCarsFilter.Orderby = Orderby; objCarsFilter.ZipCode = Zipcode; objCarsFilter.Sort = sort; switch (Mileage) { case "Mileage1": objCarsFilter.Mileage1 = "Mileage1"; break; case "Mileage2": objCarsFilter.Mileage2 = "Mileage2"; break; case "Mileage3": objCarsFilter.Mileage3 = "Mileage3"; break; case "Mileage4": objCarsFilter.Mileage4 = "Mileage4"; break; case "Mileage5": objCarsFilter.Mileage5 = "Mileage5"; break; case "Mileage6": objCarsFilter.Mileage6 = "Mileage6"; break; case "Mileage7": objCarsFilter.Mileage7 = "Mileage7"; break; } switch (Year) { case "Year1a": objCarsFilter.Year1a = "Year1a"; break; case "Year1b": objCarsFilter.Year1b = "Year1b"; break; case "Year1": objCarsFilter.Year1 = "Year1"; break; case "Year2": objCarsFilter.Year2 = "Year2"; break; case "Year3": objCarsFilter.Year3 = "Year3"; break; case "Year4": objCarsFilter.Year4 = "Year4"; break; case "Year5": objCarsFilter.Year5 = "Year5"; break; case "Year6": objCarsFilter.Year6 = "Year6"; break; case "Year7": objCarsFilter.Year7 = "Year7"; break; } switch (Price) { case "Price1": objCarsFilter.Price1 = "Price1"; break; case "Price2": objCarsFilter.Price2 = "Price2"; break; case "Price3": objCarsFilter.Price3 = "Price3"; break; case "Price4": objCarsFilter.Price4 = "Price4"; break; case "Price5": objCarsFilter.Price5 = "Price5"; break; }; FilterCars objFilterCars = new FilterCars(); MobileBL objMobileBL = new MobileBL(); if (CustomerID.Trim() != "") { string parameter = carMake + "," + CarModal + "," + Mileage + "," + Year + "," + Price + "," + Sort + "," + Orderby + "," + Zipcode; DataSet dsSaveCustInfo = objMobileBL.SaveMobileCustomerInfo("GetCarsFilterMobile", CustomerID, AuthenticationID, parameter); } if (AuthenticationID == ConfigurationManager.AppSettings["AppleID"].ToString()) { objFilterdata = (List<CarsInfo.UsedCarsInfo>)objFilterCars.FilterSearchMobileAndroid(objCarsFilter); } return objFilterdata; }
public List<CarsInfo.UsedCarsInfo> GetCarsFilterMobile(string carMakeID, string CarModalId, string Mileage, string Year, string Price, string Sort, string Orderby, string pageSize, string CurrentPage, string Zipcode) { CarsFilter objCarsFilter = new CarsFilter(); Filter objFilter = new Filter(); List<CarsInfo.UsedCarsInfo> objFilterdata = new List<CarsInfo.UsedCarsInfo>(); CarsInfo.UsedCarsInfo OBJ = new CarsInfo.UsedCarsInfo(); string sort = string.Empty; objCarsFilter.CurrentPage = CurrentPage; objCarsFilter.PageSize = pageSize; objCarsFilter.CarMakeid = carMakeID; objCarsFilter.CarModalId = CarModalId; objCarsFilter.Sort = Sort; objCarsFilter.Orderby = Orderby; objCarsFilter.ZipCode = Zipcode; objCarsFilter.Sort = sort; switch (Mileage) { case "Mileage1": objCarsFilter.Mileage1 = "Mileage1"; break; case "Mileage2": objCarsFilter.Mileage2 = "Mileage2"; break; case "Mileage3": objCarsFilter.Mileage3 = "Mileage3"; break; case "Mileage4": objCarsFilter.Mileage4 = "Mileage4"; break; case "Mileage5": objCarsFilter.Mileage5 = "Mileage5"; break; case "Mileage6": objCarsFilter.Mileage6 = "Mileage6"; break; case "Mileage7": objCarsFilter.Mileage7 = "Mileage7"; break; } switch (Year) { case "Year1a": objCarsFilter.Year1a = "Year1a"; break; case "Year1b": objCarsFilter.Year1b = "Year1b"; break; case "Year1": objCarsFilter.Year1 = "Year1"; break; case "Year2": objCarsFilter.Year2 = "Year2"; break; case "Year3": objCarsFilter.Year3 = "Year3"; break; case "Year4": objCarsFilter.Year4 = "Year4"; break; case "Year5": objCarsFilter.Year5 = "Year5"; break; case "Year6": objCarsFilter.Year6 = "Year6"; break; case "Year7": objCarsFilter.Year7 = "Year7"; break; } switch (Price) { case "Price1": objCarsFilter.Price1 = "Price1"; break; case "Price2": objCarsFilter.Price2 = "Price2"; break; case "Price3": objCarsFilter.Price3 = "Price3"; break; case "Price4": objCarsFilter.Price4 = "Price4"; break; case "Price5": objCarsFilter.Price5 = "Price5"; break; }; FilterCars objFilterCars = new FilterCars(); objFilterdata = (List<CarsInfo.UsedCarsInfo>)objFilterCars.FilterSearchMobile(objCarsFilter); return objFilterdata; }
public List<CarsInfo.UsedCarsInfo> MobileCarsNotificationSearch(string carMake, string CarModal, string Mileage, string Year, string Price, string Orderby, string Zipcode, string exteriorColor, string interiorColor, string Transmission, string VehiceCondition, string DriveTrain, string numberOfCylinder, string numberOfDoors, string fuelType, string AuthenticationID, string CustomerID) { CarsFilter objCarsFilter = new CarsFilter(); Filter objFilter = new Filter(); List<CarsInfo.UsedCarsInfo> objFilterdata = new List<CarsInfo.UsedCarsInfo>(); CarsInfo.UsedCarsInfo OBJ = new CarsInfo.UsedCarsInfo(); string sort = string.Empty; objCarsFilter.CarMakeid = carMake; objCarsFilter.CarModalId = CarModal; objCarsFilter.Orderby = Orderby; objCarsFilter.ZipCode = Zipcode; switch (Mileage) { case "Mileage1": objCarsFilter.Mileage1 = "Mileage1"; break; case "Mileage2": objCarsFilter.Mileage2 = "Mileage2"; break; case "Mileage3": objCarsFilter.Mileage3 = "Mileage3"; break; case "Mileage4": objCarsFilter.Mileage4 = "Mileage4"; break; case "Mileage5": objCarsFilter.Mileage5 = "Mileage5"; break; case "Mileage6": objCarsFilter.Mileage6 = "Mileage6"; break; case "Mileage7": objCarsFilter.Mileage7 = "Mileage7"; break; } switch (Year) { case "Year1a": objCarsFilter.Year1a = "Year1a"; break; case "Year1b": objCarsFilter.Year1b = "Year1b"; break; case "Year1": objCarsFilter.Year1 = "Year1"; break; case "Year2": objCarsFilter.Year2 = "Year2"; break; case "Year3": objCarsFilter.Year3 = "Year3"; break; case "Year4": objCarsFilter.Year4 = "Year4"; break; case "Year5": objCarsFilter.Year5 = "Year5"; break; case "Year6": objCarsFilter.Year6 = "Year6"; break; case "Year7": objCarsFilter.Year7 = "Year7"; break; } switch (Price) { case "Price1": objCarsFilter.Price1 = "Price1"; break; case "Price2": objCarsFilter.Price2 = "Price2"; break; case "Price3": objCarsFilter.Price3 = "Price3"; break; case "Price4": objCarsFilter.Price4 = "Price4"; break; case "Price5": objCarsFilter.Price5 = "Price5"; break; }; NotificationBL objFilterCars = new NotificationBL(); MobileBL objMobileBL = new MobileBL(); if (CustomerID.Trim() != "") { string parameter = carMake + "," + CarModal + "," + Mileage + "," + Year + "," + Price + "," + Orderby + "," + Zipcode; DataSet dsSaveCustInfo = objMobileBL.SaveMobileCustomerInfo("MobileCarsNotificationSearch", CustomerID, AuthenticationID, parameter); } if (AuthenticationID == ConfigurationManager.AppSettings["AppleID"].ToString()) { objFilterdata = (List<CarsInfo.UsedCarsInfo>)objFilterCars.GetMobileNotificationSearch(objCarsFilter, exteriorColor.Trim(), interiorColor.Trim(), Transmission.Trim(), VehiceCondition.Trim(), DriveTrain.Trim(), numberOfCylinder.Trim(), numberOfDoors.Trim(), fuelType.Trim()); } return objFilterdata; }
public List<CarsInfo.UsedCarsInfo> GetCarsFilterNext(ArrayList AFilter, string PageResultsCount, int CurrentPage) { //List<CarsInfo.UsedCarsInfo> obj = null; //Session["FilterArray"] = AFilter; CarsFilter objCarsFilter = new CarsFilter(); Filter objFilter = new Filter(); List<CarsInfo.UsedCarsInfo> objFilterdata = new List<CarsInfo.UsedCarsInfo>(); //var = new List<CarsInfo.UsedCarsInfo>(); //List<CarsInfo.UsedCarsInfo> objUsedCarsInfo = (List<CarsInfo.UsedCarsInfo>)Session["SearchFullCarsdata"]; CarsInfo.UsedCarsInfo OBJ = new CarsInfo.UsedCarsInfo(); //IList <CarsInfo.UsedCarsInfo> = new List<CarsInfo.UsedCarsInfo>(); string Orderby = string.Empty; string sort = string.Empty; if (Session["Orderby"] != null && Session["Orderby"] != "") { Orderby = Session["Orderby"].ToString(); } else { Session["Orderby"] = "price"; } if (Session["sort"] != null) { sort = Session["sort"].ToString(); } else { sort = "desc"; } objCarsFilter.CurrentPage = CurrentPage.ToString(); objCarsFilter.PageSize = PageResultsCount; objCarsFilter.CarMakeid = Session["carMake"].ToString(); objCarsFilter.CarModalId = Session["CarModalId"].ToString(); objCarsFilter.ZipCode = Session["ZipCode"].ToString(); objCarsFilter.WithinZip = Session["WithinZip"].ToString(); objCarsFilter.Orderby = Orderby; objCarsFilter.Sort = sort; for (int i = 0; i < AFilter.Count; i++) { switch (AFilter[i].ToString()) { case "Mileage1": objCarsFilter.Mileage1 = "Mileage1"; break; case "Mileage2": objCarsFilter.Mileage2 = "Mileage2"; break; case "Mileage3": objCarsFilter.Mileage3 = "Mileage3"; break; case "Mileage4": objCarsFilter.Mileage4 = "Mileage4"; break; case "Mileage5": objCarsFilter.Mileage5 = "Mileage5"; break; case "Mileage6": objCarsFilter.Mileage6 = "Mileage6"; break; case "Mileage7": objCarsFilter.Mileage7 = "Mileage7"; break; case "Year1a": objCarsFilter.Year1a = "Year1a"; break; case "Year1b": objCarsFilter.Year1b = "Year1b"; break; case "Year1": objCarsFilter.Year1 = "Year1"; break; case "Year2": objCarsFilter.Year2 = "Year2"; break; case "Year3": objCarsFilter.Year3 = "Year3"; break; case "Year4": objCarsFilter.Year4 = "Year4"; break; case "Year5": objCarsFilter.Year5 = "Year5"; break; case "Year6": objCarsFilter.Year6 = "Year6"; break; case "Year7": objCarsFilter.Year7 = "Year7"; break; case "Price1": objCarsFilter.Price1 = "Price1"; break; case "Price2": objCarsFilter.Price2 = "Price2"; break; case "Price3": objCarsFilter.Price3 = "Price3"; break; case "Price4": objCarsFilter.Price4 = "Price4"; break; case "Price5": objCarsFilter.Price5 = "Price5"; break; case "Body1": objCarsFilter.Body1 = "Body1"; break; case "Body2": objCarsFilter.Body2 = "Body2"; break; case "Body3": objCarsFilter.Body3 = "Body3"; break; case "Body4": objCarsFilter.Body4 = "Body4"; break; case "Body5": objCarsFilter.Body5 = "Body5"; break; case "Body6": objCarsFilter.Body6 = "Body6"; break; case "Body7": objCarsFilter.Body7 = "Body7"; break; case "Body8": objCarsFilter.Body8 = "Body8"; break; case "Body9": objCarsFilter.Body9 = "Body9"; break; case "Fuel1": objCarsFilter.Fuel1 = "Fuel1"; break; case "Fuel2": objCarsFilter.Fuel2 = "Fuel2"; break; case "Fuel3": objCarsFilter.Fuel3 = "Fuel3"; break; case "Fuel4": objCarsFilter.Fuel4 = "Fuel4"; break; case "Fuel5": objCarsFilter.Fuel5 = "Fuel5"; break; case "Seller1": objCarsFilter.Seller1 = "Seller1"; break; case "Seller2": objCarsFilter.Seller2 = "Seller2"; break; case "withpic": objCarsFilter.WithPic = true; break; case "withoutpic": objCarsFilter.WithPic = false; break; }; } FilterCars objFilterCars = new FilterCars(); objFilterdata = (List<CarsInfo.UsedCarsInfo>)objFilterCars.FilterSearch(objCarsFilter); Session["SearchCarsdata"] = objFilterdata; return objFilterdata; // }