public IList<UsedCarsInfo> FindDealerCarID(string DealerCarID, string DealerCode)
        {
            ///objUsedCars.Decalaring CarsInfo division object collection
            IList<UsedCarsInfo> UsedCarsIList = new List<UsedCarsInfo>();

            string spNameString = string.Empty;

            //objUsedCars.Setting Connection
            //objUsedCars.Global.INSTANCE_NAME = strCurrentConn;

            IDataReader UsedCarsDataReader = null;

            //objUsedCars.Connect to the database
            Database dbDatabase = DatabaseFactory.CreateDatabase(Global.INSTANCE_NAME);

            //objUsedCars.Assign stored procedure name

            spNameString = "[USP_FindDealerCarID]";
            DbCommand dbCommand = null;

            try
            {
                //objUsedCars.Set stored procedure to the command object
                dbCommand = dbDatabase.GetStoredProcCommand(spNameString);
                dbCommand.CommandTimeout = 10000;

                dbDatabase.AddInParameter(dbCommand, "@DealerCarID", DbType.String, DealerCarID);
                dbDatabase.AddInParameter(dbCommand, "@DealerCode", DbType.String, DealerCode);

                //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();
                    AssignCarsInfoList1(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;
        }
Example #2
0
        public DataSet USP_SaveCarDetails(CarsInfo.UsedCarsInfo objCarsInfo, string Description, string ConditionDescription, string Title, int TranBy)
        {
            try
            {
                DataSet  dsCars       = new DataSet();
                string   spNameString = string.Empty;
                Database dbDatabase   = DatabaseFactory.CreateDatabase(Global.INSTANCE_NAME);
                spNameString = "[USP_SaveDealerCarDetails]";
                DbCommand dbCommand = null;
                dbCommand = dbDatabase.GetStoredProcCommand(spNameString);
                dbDatabase.AddInParameter(dbCommand, "@YearOfMake", System.Data.DbType.Int32, objCarsInfo.YearOfMake);
                dbDatabase.AddInParameter(dbCommand, "@MakeModelID", System.Data.DbType.Int32, objCarsInfo.MakeModelID);
                dbDatabase.AddInParameter(dbCommand, "@BodyTypeID", System.Data.DbType.Int32, objCarsInfo.BodytypeID);
                dbDatabase.AddInParameter(dbCommand, "@VehicleConditionID", System.Data.DbType.Int32, objCarsInfo.VehicleConditionID);
                dbDatabase.AddInParameter(dbCommand, "@CarID", System.Data.DbType.Int32, objCarsInfo.Carid);
                dbDatabase.AddInParameter(dbCommand, "@Price", System.Data.DbType.String, objCarsInfo.Price);
                dbDatabase.AddInParameter(dbCommand, "@Mileage", System.Data.DbType.String, objCarsInfo.Mileage);
                dbDatabase.AddInParameter(dbCommand, "@ExteriorColor", System.Data.DbType.String, objCarsInfo.ExteriorColor);
                dbDatabase.AddInParameter(dbCommand, "@Transmission", System.Data.DbType.String, objCarsInfo.Transmission);
                dbDatabase.AddInParameter(dbCommand, "@InteriorColor", System.Data.DbType.String, objCarsInfo.InteriorColor);
                dbDatabase.AddInParameter(dbCommand, "@NumberOfDoors", System.Data.DbType.String, objCarsInfo.NumberOfDoors);
                dbDatabase.AddInParameter(dbCommand, "@VIN", System.Data.DbType.String, objCarsInfo.VIN);
                dbDatabase.AddInParameter(dbCommand, "@NumberOfCylinder", System.Data.DbType.String, objCarsInfo.NumberOfCylinder);
                dbDatabase.AddInParameter(dbCommand, "@FuelTypeID", System.Data.DbType.Int32, objCarsInfo.FueltypeId);
                dbDatabase.AddInParameter(dbCommand, "@Zipcode", System.Data.DbType.String, objCarsInfo.Zipcode);
                dbDatabase.AddInParameter(dbCommand, "@City", System.Data.DbType.String, objCarsInfo.City);
                dbDatabase.AddInParameter(dbCommand, "@StateID", System.Data.DbType.Int32, objCarsInfo.StateID);
                dbDatabase.AddInParameter(dbCommand, "@Description", System.Data.DbType.String, Description);
                dbDatabase.AddInParameter(dbCommand, "@ConditionDescription", System.Data.DbType.String, ConditionDescription);
                dbDatabase.AddInParameter(dbCommand, "@DriveTrain", System.Data.DbType.String, objCarsInfo.DriveTrain);
                dbDatabase.AddInParameter(dbCommand, "@Title", System.Data.DbType.String, Title);
                dbDatabase.AddInParameter(dbCommand, "@TranBy", System.Data.DbType.Int32, TranBy);

                dbDatabase.AddInParameter(dbCommand, "@SellingPrice", System.Data.DbType.String, objCarsInfo.CurrentPrice);
                dbDatabase.AddInParameter(dbCommand, "@PurchaseCost", System.Data.DbType.String, objCarsInfo.PurchaseCost);



                dsCars = dbDatabase.ExecuteDataSet(dbCommand);
                return(dsCars);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #3
0
        public bool UpdatePicturesById(CarsInfo.UsedCarsInfo objCarsInfo, int TranBy)
        {
            try
            {
                bool     bnew         = false;
                string   spNameString = string.Empty;
                Database dbDatabase   = DatabaseFactory.CreateDatabase(Global.INSTANCE_NAME);
                spNameString = "USP_UpdatePicturesById";
                DbCommand dbCommand = null;
                dbCommand = dbDatabase.GetStoredProcCommand(spNameString);

                dbDatabase.AddInParameter(dbCommand, "@pic1", System.Data.DbType.String, objCarsInfo.PIC1);
                dbDatabase.AddInParameter(dbCommand, "@pic2", System.Data.DbType.String, objCarsInfo.PIC2);
                dbDatabase.AddInParameter(dbCommand, "@pic3", System.Data.DbType.String, objCarsInfo.PIC3);
                dbDatabase.AddInParameter(dbCommand, "@pic4", System.Data.DbType.String, objCarsInfo.PIC4);
                dbDatabase.AddInParameter(dbCommand, "@pic5", System.Data.DbType.String, objCarsInfo.PIC5);
                dbDatabase.AddInParameter(dbCommand, "@pic6", System.Data.DbType.String, objCarsInfo.PIC6);
                dbDatabase.AddInParameter(dbCommand, "@pic7", System.Data.DbType.String, objCarsInfo.PIC7);
                dbDatabase.AddInParameter(dbCommand, "@pic8", System.Data.DbType.String, objCarsInfo.PIC8);
                dbDatabase.AddInParameter(dbCommand, "@pic9", System.Data.DbType.String, objCarsInfo.PIC9);
                dbDatabase.AddInParameter(dbCommand, "@pic10", System.Data.DbType.String, objCarsInfo.PIC10);
                dbDatabase.AddInParameter(dbCommand, "@Pic11", System.Data.DbType.String, objCarsInfo.PIC11);
                dbDatabase.AddInParameter(dbCommand, "@pic12", System.Data.DbType.String, objCarsInfo.PIC12);
                dbDatabase.AddInParameter(dbCommand, "@pic13", System.Data.DbType.String, objCarsInfo.PIC13);
                dbDatabase.AddInParameter(dbCommand, "@pic14", System.Data.DbType.String, objCarsInfo.PIC14);
                dbDatabase.AddInParameter(dbCommand, "@pic15", System.Data.DbType.String, objCarsInfo.PIC15);
                dbDatabase.AddInParameter(dbCommand, "@pic16", System.Data.DbType.String, objCarsInfo.PIC16);
                dbDatabase.AddInParameter(dbCommand, "@pic17", System.Data.DbType.String, objCarsInfo.PIC17);
                dbDatabase.AddInParameter(dbCommand, "@pic18", System.Data.DbType.String, objCarsInfo.PIC18);
                dbDatabase.AddInParameter(dbCommand, "@pic19", System.Data.DbType.String, objCarsInfo.PIC19);
                dbDatabase.AddInParameter(dbCommand, "@pic20", System.Data.DbType.String, objCarsInfo.PIC20);
                dbDatabase.AddInParameter(dbCommand, "@Pic0", System.Data.DbType.String, objCarsInfo.PIC0);
                dbDatabase.AddInParameter(dbCommand, "@CarID", System.Data.DbType.Int32, objCarsInfo.Carid);
                dbDatabase.AddInParameter(dbCommand, "@TranBy", System.Data.DbType.Int32, TranBy);

                dbDatabase.ExecuteDataSet(dbCommand);
                bnew = true;
                return(bnew);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #4
0
        public IList<UsedCarsInfo> MopbileFindCarsByUID(string UID)
        {
            ///objUsedCars.Decalaring CarsInfo division object collection
            IList<UsedCarsInfo> UsedCarsIList = new List<UsedCarsInfo>();

            string spNameString = string.Empty;

            //objUsedCars.Setting Connection
            //objUsedCars.Global.INSTANCE_NAME = strCurrentConn;

            IDataReader UsedCarsDataReader = null;

            //objUsedCars.Connect to the database
            Database dbDatabase = DatabaseFactory.CreateDatabase(Global.INSTANCE_NAME);

            //objUsedCars.Assign stored procedure name

            spNameString = "[USP_MobileFindCarsByUID]";

            DbCommand dbCommand = null;

            try
            {
                //objUsedCars.Set stored procedure to the command object
                dbCommand = dbDatabase.GetStoredProcCommand(spNameString);
                dbCommand.CommandTimeout = 10000;

                dbDatabase.AddInParameter(dbCommand, "@UID", DbType.String, UID);

                //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)
            {

            }
            finally
            {
                UsedCarsDataReader.Close();
            }

            return UsedCarsIList;
        }
Example #5
0
        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;
        }
Example #6
0
        public IList<UsedCarsInfo> SearchUsedCarsSort(string carMakeid, string CarModalId, string ZipCode, string WithinZip,
            string currentPage, string pageSize,
            string Orderby, string sortorder)
        {
            ///objUsedCars.Decalaring CarsInfo division object collection
            IList<UsedCarsInfo> UsedCarsIList = new List<UsedCarsInfo>();

            string spNameString = string.Empty;

            //objUsedCars.Setting Connection
            //objUsedCars.Global.INSTANCE_NAME = strCurrentConn;

            IDataReader UsedCarsDataReader = null;

            //objUsedCars.Connect to the database
            Database dbDatabase = DatabaseFactory.CreateDatabase(Global.INSTANCE_NAME);

            //objUsedCars.Assign stored procedure name

            spNameString = "[USP_SearchCarsSort]";
            DbCommand dbCommand = null;

            try
            {
                //objUsedCars.Set stored procedure to the command object
                dbCommand = dbDatabase.GetStoredProcCommand(spNameString);
                dbCommand.CommandTimeout = 10000;

                dbDatabase.AddInParameter(dbCommand, "@makeID", DbType.String, carMakeid);
                dbDatabase.AddInParameter(dbCommand, "@makeModelID", DbType.String, CarModalId);
                dbDatabase.AddInParameter(dbCommand, "@Nearby", DbType.Int64, WithinZip);
                dbDatabase.AddInParameter(dbCommand, "@Pin", DbType.Int64, ZipCode);
                dbDatabase.AddInParameter(dbCommand, "@currentPage", DbType.Int64, currentPage);
                dbDatabase.AddInParameter(dbCommand, "@pageSize", DbType.Int64, pageSize);
                dbDatabase.AddInParameter(dbCommand, "@Orderby", DbType.String, Orderby);
                dbDatabase.AddInParameter(dbCommand, "@Sort", DbType.String, sortorder);

                //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 string UpdateSellerInformation(string sellerID, string sellerName,string city, string state, string zip, string phone, string email, string carID, string UID, string AuthenticationID, string CustomerID, string SessionID)
    {
        string returnPostingID = "Failure";

        MobileBL objMobileBL = new MobileBL();
        if (CustomerID.Trim() != "")
        {
            DataSet dsSaveCustInfo = objMobileBL.SaveMobileCustomerInfo("UpdateSellerInformation", CustomerID, AuthenticationID,sellerID);
        }
         bool bnew = objMobileBL.CheckMobileAuthorizeUSer(SessionID, Convert.ToInt32(UID));
         if (bnew)
         {
             try
             {
                 if (AuthenticationID == ConfigurationManager.AppSettings["AppleID"].ToString())
                 {
                     UsedCarsInfo objUsedCarsInfo = new UsedCarsInfo();
                     objUsedCarsInfo.SellerID = Convert.ToInt32(sellerID);
                     objUsedCarsInfo.SellerName = sellerName;
                     objUsedCarsInfo.City = city;
                     objUsedCarsInfo.State = state;
                     objUsedCarsInfo.Zip = zip;
                     objUsedCarsInfo.Phone = phone;
                     objUsedCarsInfo.Email = email;

                     DataSet dsposting = new DataSet();
                     dsposting = objMobileBL.UpdateMobileSellerInfo(objUsedCarsInfo, Convert.ToInt32(carID), Convert.ToInt32(UID));

                     if (dsposting.Tables.Count > 0)
                     {
                         if (dsposting.Tables[0].Rows.Count > 0)
                         {
                             returnPostingID = "Success";
                         }
                     }
                 }
             }
             catch (Exception ex)
             {
             }
         }
         else
         {
             returnPostingID = "Session timed out";
         }
        return returnPostingID;
    }
    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 DataSet SaveCarDetailsForBulkUploadDealers(UsedCarsInfo objCarsInfo,
            string SellerID, String SellerTypeID, string Source, String SourcePicID, string DealerCarid, string UserPackID, string DealerCode)
        {
            try
            {
                DataSet dsCars = new DataSet();
                string spNameString = string.Empty;
                Database dbDatabase = DatabaseFactory.CreateDatabase(Global.INSTANCE_NAME);
                spNameString = "USP_SaveCarDetailsForBulkUploadDealers";
                DbCommand dbCommand = null;
                dbCommand = dbDatabase.GetStoredProcCommand(spNameString);
                dbCommand.CommandTimeout = 1500;

                dbDatabase.AddInParameter(dbCommand, "@YearOfMake", System.Data.DbType.String, objCarsInfo.YearOfMake);
                dbDatabase.AddInParameter(dbCommand, "@Make", System.Data.DbType.String, objCarsInfo.Make);
                dbDatabase.AddInParameter(dbCommand, "@Model", System.Data.DbType.String, objCarsInfo.Model);
                dbDatabase.AddInParameter(dbCommand, "@BodyType", System.Data.DbType.String, objCarsInfo.Bodytype);
                dbDatabase.AddInParameter(dbCommand, "@VehicleCondition", System.Data.DbType.String, objCarsInfo.VehicleConditionID);
                dbDatabase.AddInParameter(dbCommand, "@Price", System.Data.DbType.String, objCarsInfo.Price);
                dbDatabase.AddInParameter(dbCommand, "@Mileage", System.Data.DbType.String, objCarsInfo.Mileage);
                dbDatabase.AddInParameter(dbCommand, "@ExteriorColor", System.Data.DbType.String, objCarsInfo.ExteriorColor);
                dbDatabase.AddInParameter(dbCommand, "@InteriorColor", System.Data.DbType.String, objCarsInfo.InteriorColor);

                dbDatabase.AddInParameter(dbCommand, "@Transmission", System.Data.DbType.String, objCarsInfo.Transmission);
                dbDatabase.AddInParameter(dbCommand, "@NumberOfDoors", System.Data.DbType.String, objCarsInfo.NumberOfDoors);
                dbDatabase.AddInParameter(dbCommand, "@VIN", System.Data.DbType.String, objCarsInfo.VIN);
                dbDatabase.AddInParameter(dbCommand, "@NumberOfCylinder", System.Data.DbType.String, objCarsInfo.NumberOfCylinder);

                dbDatabase.AddInParameter(dbCommand, "@FuelTypeID", System.Data.DbType.String, objCarsInfo.Fueltype);
                dbDatabase.AddInParameter(dbCommand, "@Zipcode", System.Data.DbType.String, objCarsInfo.Zipcode);
                dbDatabase.AddInParameter(dbCommand, "@City", System.Data.DbType.String, objCarsInfo.City);
                dbDatabase.AddInParameter(dbCommand, "@StateID", System.Data.DbType.String, objCarsInfo.State);
                dbDatabase.AddInParameter(dbCommand, "@Description", System.Data.DbType.String, objCarsInfo.Description);
                dbDatabase.AddInParameter(dbCommand, "@ConditionDescription", System.Data.DbType.String, objCarsInfo.ConditionDescription);
                dbDatabase.AddInParameter(dbCommand, "@DriveTrain", System.Data.DbType.String, objCarsInfo.DriveTrain);
                dbDatabase.AddInParameter(dbCommand, "@sellerID", System.Data.DbType.String, SellerID);
                dbDatabase.AddInParameter(dbCommand, "@SellerType", System.Data.DbType.String, SellerTypeID);
                dbDatabase.AddInParameter(dbCommand, "@Source", System.Data.DbType.String, Source);
                dbDatabase.AddInParameter(dbCommand, "@SourcePicID", System.Data.DbType.String, SourcePicID);
                dbDatabase.AddInParameter(dbCommand, "@DealerCarID", System.Data.DbType.String, DealerCarid);

                dbDatabase.AddInParameter(dbCommand, "@address1", System.Data.DbType.String, objCarsInfo.Address1);
                dbDatabase.AddInParameter(dbCommand, "@sellerName", System.Data.DbType.String, objCarsInfo.SellerName);
                dbDatabase.AddInParameter(dbCommand, "@PackageID", System.Data.DbType.String, objCarsInfo.PackageID);
                dbDatabase.AddInParameter(dbCommand, "@UserPackID", System.Data.DbType.String, UserPackID);
                dbDatabase.AddInParameter(dbCommand, "@Phone", System.Data.DbType.String, objCarsInfo.Phone);
                dbDatabase.AddInParameter(dbCommand, "@Email", System.Data.DbType.String, objCarsInfo.Email);
                dbDatabase.AddInParameter(dbCommand, "@DealerCode", System.Data.DbType.String, DealerCode);

                dbDatabase.AddInParameter(dbCommand, "@UID", System.Data.DbType.String, objCarsInfo.Uid);

                //dbDatabase.AddInParameter(dbCommand, "@SellingPrice", System.Data.DbType.String, objCarsInfo.CurrentPrice);
                //dbDatabase.AddInParameter(dbCommand, "@PurchaseCost", System.Data.DbType.String, objCarsInfo.PurchaseCost);

                dsCars = dbDatabase.ExecuteDataSet(dbCommand);
                return dsCars;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    protected void imageOrder_Click(object sender, EventArgs e)
    {
        try
        {
            string CarID = hdnCarID.Value;
            string Make = hdnMake.Value;
            string Model = hdnModel.Value;
            string Year = hdnYear.Value;
            string Pic0 = hdnPic0.Value;
            string Pic1 = hdnPic1.Value;
            string Pic2 = hdnPic2.Value;
            string Pic3 = hdnPic3.Value;
            string Pic4 = hdnPic4.Value;
            string Pic5 = hdnPic5.Value;
            string Pic6 = hdnPic6.Value;
            string Pic7 = hdnPic7.Value;
            string Pic8 = hdnPic8.Value;
            string Pic9 = hdnPic9.Value;
            string Pic10 = hdnPic10.Value;
            string Pic11 = hdnPic11.Value;
            string Pic12 = hdnPic12.Value;
            string Pic13 = hdnPic13.Value;
            string Pic14 = hdnPic14.Value;
            string Pic15 = hdnPic15.Value;
            string Pic16 = hdnPic16.Value;
            string Pic17 = hdnPic17.Value;
            string Pic18 = hdnPic18.Value;
            string Pic19 = hdnPic19.Value;
            string Pic20 = hdnPic20.Value;

            DataSet dsImagesData = objDealerAction.USP_GetImages(Convert.ToInt32(CarID), 7);

            //DataSet dsImagesData = Session["GetImages"] as DataSet;
            UsedCarsInfo objcarsInfo = new UsedCarsInfo();

            objcarsInfo.PIC0 = dsImagesData.Tables[0].Rows[0]["pic0"].ToString();
            objcarsInfo.PIC1 = dsImagesData.Tables[0].Rows[0]["pic1"].ToString();
            objcarsInfo.PIC2 = dsImagesData.Tables[0].Rows[0]["pic2"].ToString();
            objcarsInfo.PIC3 = dsImagesData.Tables[0].Rows[0]["pic3"].ToString();
            objcarsInfo.PIC4 = dsImagesData.Tables[0].Rows[0]["pic4"].ToString();
            objcarsInfo.PIC5 = dsImagesData.Tables[0].Rows[0]["pic5"].ToString();
            objcarsInfo.PIC6 = dsImagesData.Tables[0].Rows[0]["pic6"].ToString();
            objcarsInfo.PIC7 = dsImagesData.Tables[0].Rows[0]["pic7"].ToString();
            objcarsInfo.PIC8 = dsImagesData.Tables[0].Rows[0]["pic8"].ToString();
            objcarsInfo.PIC9 = dsImagesData.Tables[0].Rows[0]["pic9"].ToString();
            objcarsInfo.PIC10 = dsImagesData.Tables[0].Rows[0]["pic10"].ToString();
            objcarsInfo.PIC11 = dsImagesData.Tables[0].Rows[0]["pic11"].ToString();
            objcarsInfo.PIC12 = dsImagesData.Tables[0].Rows[0]["pic12"].ToString();
            objcarsInfo.PIC13 = dsImagesData.Tables[0].Rows[0]["pic13"].ToString();
            objcarsInfo.PIC14 = dsImagesData.Tables[0].Rows[0]["pic14"].ToString();
            objcarsInfo.PIC15 = dsImagesData.Tables[0].Rows[0]["pic15"].ToString();
            objcarsInfo.PIC16 = dsImagesData.Tables[0].Rows[0]["pic16"].ToString();
            objcarsInfo.PIC17 = dsImagesData.Tables[0].Rows[0]["pic17"].ToString();
            objcarsInfo.PIC18 = dsImagesData.Tables[0].Rows[0]["pic18"].ToString();
            objcarsInfo.PIC19 = dsImagesData.Tables[0].Rows[0]["pic19"].ToString();
            objcarsInfo.PIC20 = dsImagesData.Tables[0].Rows[0]["pic20"].ToString();

            if ((Pic1 != null) && (Pic1 != "") && (Pic1 != "0"))
            {
                if (objcarsInfo.PIC1 != Pic1)
                {
                    DataSet dsdata = objDealerAction.GetPictureLocationByID(Pic1);
                    string FileNameSaveData1 = Server.MapPath(dsdata.Tables[0].Rows[0]["picturelocation"].ToString() + dsdata.Tables[0].Rows[0]["picturename"].ToString());
                    string FileNameSaveData = dsdata.Tables[0].Rows[0]["picturelocation"].ToString() + dsdata.Tables[0].Rows[0]["picturename"].ToString();
                    System.Web.UI.WebControls.Image Image1 = (System.Web.UI.WebControls.Image)form1.FindControl("Img1");
                    Image1.ImageUrl = "~/" + FileNameSaveData;
                    string SavePath = dsdata.Tables[0].Rows[0]["picturelocation"].ToString();
                    string path = Server.MapPath(Image1.ImageUrl);
                    //string path = Server.MapPath(ImageName.ImageUrl);
                    string SelModelName = Model.ToString();
                    SelModelName = SelModelName.Replace("/", "@");
                    SelModelName = SelModelName.Replace("&", "@");
                    SelModelName = SelModelName.Replace(" ", "-");
                    string FileNameThumb = Year + "_" + Make + "_" + SelModelName + "_" + CarID + "_Thumb.jpg";
                    string FileNameFullThumb = Server.MapPath("~/" + dsdata.Tables[0].Rows[0]["picturelocation"].ToString());
                    System.Drawing.Image image = System.Drawing.Image.FromFile(path);
                    //int newwidthimg = 250;
                    //float AspectRatio = (float)image.Size.Width / (float)image.Size.Height;
                    //int newHeight = Convert.ToInt32(newwidthimg / AspectRatio);
                    //Bitmap thumbnailBitmap = new Bitmap(newwidthimg, newHeight);
                    //Graphics thumbnailGraph = Graphics.FromImage(thumbnailBitmap);
                    //thumbnailGraph.CompositingQuality = CompositingQuality.HighQuality;
                    //thumbnailGraph.SmoothingMode = SmoothingMode.HighQuality;
                    //thumbnailGraph.InterpolationMode = InterpolationMode.HighQualityBicubic;
                    //var imageRectangle = new Rectangle(0, 0, newwidthimg, newHeight);
                    //thumbnailGraph.DrawImage(image, imageRectangle);
                    //thumbnailBitmap.Save(SavePath, ImageFormat.Jpeg);
                    //thumbnailGraph.Dispose();
                    //thumbnailBitmap.Dispose();
                    //image.Dispose();
                    //if (System.IO.Directory.Exists(FileNameSaveData1) == false)
                    //{
                    //    System.IO.Directory.CreateDirectory(FileNameSaveData1);
                    //}

                    Bitmap oBitmap1 = default(Bitmap);
                    oBitmap1 = new Bitmap(path);
                    Graphics oGraphic1 = default(Graphics);

                    int newwidthimg1 = 250;
                    // Here create a new bitmap object of the same height and width of the image.
                    //float AspectRatio = (float)oBitmap.Size.Width / (float)oBitmap.Size.Height;
                    float AspectRatio1 = (float)oBitmap1.Size.Width / (float)oBitmap1.Size.Height;

                    int newHeight1 = Convert.ToInt32(newwidthimg1 / AspectRatio1);

                    Bitmap bmpNew1 = new Bitmap(newwidthimg1, newHeight1);
                    oGraphic1 = Graphics.FromImage(bmpNew1);

                    oGraphic1.CompositingQuality = CompositingQuality.HighQuality;
                    oGraphic1.SmoothingMode = SmoothingMode.HighQuality;
                    oGraphic1.InterpolationMode = InterpolationMode.HighQualityBicubic;

                    oGraphic1.DrawImage(oBitmap1, new Rectangle(0, 0, bmpNew1.Width, bmpNew1.Height), 0, 0, oBitmap1.Width, oBitmap1.Height, GraphicsUnit.Pixel);
                    // Release the lock on the image file. Of course,
                    // image from the image file is existing in Graphics object
                    oBitmap1.Dispose();
                    oBitmap1 = bmpNew1;

                    //SolidBrush oBrush = new SolidBrush(Color.Black);
                    //Font ofont = new Font("Arial", 8);
                    //oGraphic.DrawString("Some text to write", ofont, oBrush, 10, 10);
                    //oGraphic.Dispose();
                    //ofont.Dispose();
                    //oBrush.Dispose();
                    oBitmap1.Save(FileNameFullThumb + FileNameThumb, ImageFormat.Jpeg);

                    oBitmap1.Dispose();

                    DealerActions objDealerActions1 = new DealerActions();

                    DataSet dsImgID1 = objDealerActions1.SavePictures(SavePath, FileNameThumb, "Jpeg", Convert.ToInt32(Session[Constants.USER_ID].ToString()));

                    objcarsInfo.PIC0 = dsImgID1.Tables[0].Rows[0]["picID"].ToString();

                }
                objcarsInfo.PIC1 = Pic1;
            }
            else
            {
                objcarsInfo.PIC0 = "";
                objcarsInfo.PIC1 = "";
            }
            if ((Pic2 != null) && (Pic2 != "") && (Pic2 != "0"))
            {
                objcarsInfo.PIC2 = Pic2;
            }
            else
            {
                objcarsInfo.PIC2 = "";
            }
            if ((Pic3 != null) && (Pic3 != "") && (Pic3 != "0"))
            {
                objcarsInfo.PIC3 = Pic3;
            }
            else
            {
                objcarsInfo.PIC3 = "";
            }
            if ((Pic4 != null) && (Pic4 != "") && (Pic4 != "0"))
            {
                objcarsInfo.PIC4 = Pic4;
            }
            else
            {
                objcarsInfo.PIC4 = "";
            }
            if ((Pic5 != null) && (Pic5 != "") && (Pic5 != "0"))
            {
                objcarsInfo.PIC5 = Pic5;
            }
            else
            {
                objcarsInfo.PIC5 = "";
            }
            if ((Pic6 != null) && (Pic6 != "") && (Pic6 != "0"))
            {
                objcarsInfo.PIC6 = Pic6;
            }
            else
            {
                objcarsInfo.PIC6 = "";
            }
            if ((Pic7 != null) && (Pic7 != "") && (Pic7 != "0"))
            {
                objcarsInfo.PIC7 = Pic7;
            }
            else
            {
                objcarsInfo.PIC7 = "";
            }
            if ((Pic8 != null) && (Pic8 != "") && (Pic8 != "0"))
            {
                objcarsInfo.PIC8 = Pic8;
            }
            else
            {
                objcarsInfo.PIC8 = "";
            }
            if ((Pic9 != null) && (Pic9 != "") && (Pic9 != "0"))
            {
                objcarsInfo.PIC9 = Pic9;
            }
            else
            {
                objcarsInfo.PIC9 = "";
            }
            if ((Pic10 != null) && (Pic10 != "") && (Pic10 != "0"))
            {
                objcarsInfo.PIC10 = Pic10;
            }
            else
            {
                objcarsInfo.PIC10 = "";
            }
            if ((Pic11 != null) && (Pic11 != "") && (Pic11 != "0"))
            {
                objcarsInfo.PIC11 = Pic11;
            }
            else
            {
                objcarsInfo.PIC11 = "";
            }
            if ((Pic12 != null) && (Pic12 != "") && (Pic12 != "0"))
            {
                objcarsInfo.PIC12 = Pic10;
            }
            else
            {
                objcarsInfo.PIC12 = "";
            }
            if ((Pic13 != null) && (Pic13 != "") && (Pic13 != "0"))
            {
                objcarsInfo.PIC13 = Pic13;
            }
            else
            {
                objcarsInfo.PIC13 = "";
            }
            if ((Pic14 != null) && (Pic14 != "") && (Pic14 != "0"))
            {
                objcarsInfo.PIC14 = Pic14;
            }
            else
            {
                objcarsInfo.PIC14 = "";
            }
            if ((Pic15 != null) && (Pic15 != "") && (Pic15 != "0"))
            {
                objcarsInfo.PIC15 = Pic15;
            }
            else
            {
                objcarsInfo.PIC15 = "";
            }
            if ((Pic16 != null) && (Pic16 != "") && (Pic16 != "0"))
            {
                objcarsInfo.PIC16 = Pic16;
            }
            else
            {
                objcarsInfo.PIC16 = "";
            }
            if ((Pic17 != null) && (Pic17 != "") && (Pic17 != "0"))
            {
                objcarsInfo.PIC17 = Pic17;
            }
            else
            {
                objcarsInfo.PIC17 = "";
            }
            if ((Pic18 != null) && (Pic18 != "") && (Pic18 != "0"))
            {
                objcarsInfo.PIC18 = Pic18;
            }
            else
            {
                objcarsInfo.PIC18 = "";
            }
            if ((Pic19 != null) && (Pic19 != "") && (Pic19 != "0"))
            {
                objcarsInfo.PIC19 = Pic19;
            }
            else
            {
                objcarsInfo.PIC19 = "";
            }
            if ((Pic20 != null) && (Pic20 != "") && (Pic20 != "0"))
            {
                objcarsInfo.PIC20 = Pic20;
            }
            else
            {
                objcarsInfo.PIC20 = "";
            }
            objcarsInfo.Carid = Convert.ToInt32(CarID);
            bool bnew = objDealerAction.UpdatePicturesById(objcarsInfo, Convert.ToInt32(Session[Constants.USER_ID].ToString()));
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Example #11
0
        public IList<UsedCarsInfo> GetRecentCarsMobile_New(string sCurrentPage, string PageSize,
            string Orderby, string Sort, string zip, string Nearby)
        {
            ///objUsedCars.Decalaring CarsInfo division object collection
            IList<UsedCarsInfo> UsedCarsIList = new List<UsedCarsInfo>();

            string spNameString = string.Empty;

            //objUsedCars.Setting Connection
            //objUsedCars.Global.INSTANCE_NAME = strCurrentConn;

            IDataReader UsedCarsDataReader = null;

            //objUsedCars.Connect to the database
            Database dbDatabase = DatabaseFactory.CreateDatabase(Global.INSTANCE_NAME);

            //objUsedCars.Assign stored procedure name

            spNameString = "[USP_RecentCarsMobile_New]";
            DbCommand dbCommand = null;

            try
            {
                //objUsedCars.Set stored procedure to the command object
                dbCommand = dbDatabase.GetStoredProcCommand(spNameString);

                dbCommand.CommandTimeout = 10000;

                dbCommand.CommandTimeout = 10000;

                dbDatabase.AddInParameter(dbCommand, "@currentPage", DbType.String, sCurrentPage);
                dbDatabase.AddInParameter(dbCommand, "@pageSize", DbType.String, PageSize);
                dbDatabase.AddInParameter(dbCommand, "@Orderby", DbType.String, Orderby);
                dbDatabase.AddInParameter(dbCommand, "@Sort", DbType.String, Sort);
                dbDatabase.AddInParameter(dbCommand, "@Zipcode", DbType.String, zip);
                dbDatabase.AddInParameter(dbCommand, "@Nearby", DbType.String, Nearby);

                //objUsedCars.Executing stored procedure
                UsedCarsDataReader = dbDatabase.ExecuteReader(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;
        }
Example #12
0
        public bool USP_SaveSellerInfoForBulkUpload(UsedCarsInfo objUsedCarsInfo, int CarID, string Source, string SourcePicID, int SellerType, string HomeViewCount)
        {
            try
            {
                bool bnew = false;
                string spNameString = string.Empty;
                Database dbDatabase = DatabaseFactory.CreateDatabase(Global.INSTANCE_NAME);
                spNameString = "USP_SaveSellerInfoForBulkUpload";
                DbCommand dbCommand = null;
                dbCommand = dbDatabase.GetStoredProcCommand(spNameString);
                dbCommand.CommandTimeout = 1500;

                dbDatabase.AddInParameter(dbCommand, "@sellerID", System.Data.DbType.Int32, objUsedCarsInfo.SellerID);
                dbDatabase.AddInParameter(dbCommand, "@sellerName", System.Data.DbType.String, objUsedCarsInfo.SellerName);
                dbDatabase.AddInParameter(dbCommand, "@address1", System.Data.DbType.String, objUsedCarsInfo.Address1);
                dbDatabase.AddInParameter(dbCommand, "@city", System.Data.DbType.String, objUsedCarsInfo.City);
                dbDatabase.AddInParameter(dbCommand, "@state", System.Data.DbType.String, objUsedCarsInfo.State);
                dbDatabase.AddInParameter(dbCommand, "@Zip", System.Data.DbType.String, objUsedCarsInfo.Zip);
                dbDatabase.AddInParameter(dbCommand, "@Phone", System.Data.DbType.String, objUsedCarsInfo.Phone);
                dbDatabase.AddInParameter(dbCommand, "@email", System.Data.DbType.String, objUsedCarsInfo.Email);
                dbDatabase.AddInParameter(dbCommand, "@CarID", System.Data.DbType.Int32, CarID);
                dbDatabase.AddInParameter(dbCommand, "@Source", System.Data.DbType.String, Source);
                dbDatabase.AddInParameter(dbCommand, "@SourcePicID", System.Data.DbType.String, SourcePicID);
                dbDatabase.AddInParameter(dbCommand, "@SellerType", System.Data.DbType.Int32, SellerType);
                dbDatabase.AddInParameter(dbCommand, "@HomeViewCount", System.Data.DbType.String, HomeViewCount);

                dbDatabase.ExecuteDataSet(dbCommand);
                bnew = true;
                return bnew;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void SaveCarPicturesFromDealerSite(int CarID, string PicLocation, string PicName, int UserID)
        {
            UCEDealerSiteBL objDealer = new UCEDealerSiteBL();
            UsedCarsInfo objCarPicInfo = new UsedCarsInfo();
            Dealer.DealerActions objAction = new CarsBL.Dealer.DealerActions();
            string bSuccess = string.Empty;
            try
            {
                DataSet ds = objDealer.GetCarImageIDsToDealerSite(CarID);
                objCarPicInfo.Carid = Convert.ToInt32(CarID);
                string picId = objDealer.SaveCarPictureFromDealerSite(PicLocation, PicName, UserID);
                if (ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        objCarPicInfo.PIC0 = ds.Tables[0].Rows[0]["pic0"].ToString() == "" ? null : ds.Tables[0].Rows[0]["pic0"].ToString();
                        objCarPicInfo.PIC1 = ds.Tables[0].Rows[0]["pic1"].ToString() == "" ? null : ds.Tables[0].Rows[0]["pic1"].ToString();
                        objCarPicInfo.PIC2 = ds.Tables[0].Rows[0]["pic2"].ToString() == "" ? null: ds.Tables[0].Rows[0]["pic2"].ToString();
                        objCarPicInfo.PIC3 = ds.Tables[0].Rows[0]["pic3"].ToString() == "" ? null : ds.Tables[0].Rows[0]["pic3"].ToString();
                        objCarPicInfo.PIC4 = ds.Tables[0].Rows[0]["pic4"].ToString() == "" ? null : ds.Tables[0].Rows[0]["pic4"].ToString();
                        objCarPicInfo.PIC5 = ds.Tables[0].Rows[0]["pic5"].ToString() == "" ? null : ds.Tables[0].Rows[0]["pic5"].ToString();
                        objCarPicInfo.PIC6 = ds.Tables[0].Rows[0]["pic6"].ToString() == "" ? null : ds.Tables[0].Rows[0]["pic6"].ToString();
                        objCarPicInfo.PIC7 = ds.Tables[0].Rows[0]["pic7"].ToString() == "" ? null : ds.Tables[0].Rows[0]["pic7"].ToString();
                        objCarPicInfo.PIC8 = ds.Tables[0].Rows[0]["pic8"].ToString() == "" ? null : ds.Tables[0].Rows[0]["pic8"].ToString();
                        objCarPicInfo.PIC9 = ds.Tables[0].Rows[0]["pic9"].ToString() == "" ? null : ds.Tables[0].Rows[0]["pic9"].ToString();
                        objCarPicInfo.PIC10 = ds.Tables[0].Rows[0]["pic10"].ToString() == "" ? null : ds.Tables[0].Rows[0]["pic10"].ToString();
                        objCarPicInfo.PIC11 = ds.Tables[0].Rows[0]["pic11"].ToString() == "" ? null : ds.Tables[0].Rows[0]["pic11"].ToString();
                        objCarPicInfo.PIC12 = ds.Tables[0].Rows[0]["pic12"].ToString() == "" ? null : ds.Tables[0].Rows[0]["pic12"].ToString();
                        objCarPicInfo.PIC13 = ds.Tables[0].Rows[0]["pic13"].ToString() == "" ? null : ds.Tables[0].Rows[0]["pic13"].ToString();
                        objCarPicInfo.PIC14 = ds.Tables[0].Rows[0]["pic14"].ToString() == "" ? null : ds.Tables[0].Rows[0]["pic14"].ToString();
                        objCarPicInfo.PIC15 = ds.Tables[0].Rows[0]["pic15"].ToString() == "" ? null : ds.Tables[0].Rows[0]["pic15"].ToString();
                        objCarPicInfo.PIC16 = ds.Tables[0].Rows[0]["pic16"].ToString() == "" ? null : ds.Tables[0].Rows[0]["pic16"].ToString();
                        objCarPicInfo.PIC17 = ds.Tables[0].Rows[0]["pic17"].ToString() == "" ? null : ds.Tables[0].Rows[0]["pic17"].ToString();
                        objCarPicInfo.PIC18 = ds.Tables[0].Rows[0]["pic18"].ToString() == "" ? null : ds.Tables[0].Rows[0]["pic18"].ToString();
                        objCarPicInfo.PIC19 = ds.Tables[0].Rows[0]["pic19"].ToString() == "" ? null : ds.Tables[0].Rows[0]["pic19"].ToString();
                        objCarPicInfo.PIC20 = ds.Tables[0].Rows[0]["pic20"].ToString() == "" ? null : ds.Tables[0].Rows[0]["pic20"].ToString();

                        if (objCarPicInfo.PIC0 == null || objCarPicInfo.PIC0 == "")
                        {
                            objCarPicInfo.PIC0 = picId;
                        }
                        else if (objCarPicInfo.PIC1 == null || objCarPicInfo.PIC1 == "")
                        {
                            objCarPicInfo.PIC1 = picId;
                        }
                        else if (objCarPicInfo.PIC2 == null || objCarPicInfo.PIC2 == "")
                        {
                            objCarPicInfo.PIC2 = picId;
                        }
                        else if (objCarPicInfo.PIC3 == null || objCarPicInfo.PIC3 == "")
                        {
                            objCarPicInfo.PIC3 = picId;

                        }
                        else if (objCarPicInfo.PIC4 == null || objCarPicInfo.PIC4 == "")
                        {
                            objCarPicInfo.PIC4 = picId;
                        }
                        else if (objCarPicInfo.PIC5 == null || objCarPicInfo.PIC5 == "")
                        {
                            objCarPicInfo.PIC5 = picId;
                        }
                        else if (objCarPicInfo.PIC6 == null || objCarPicInfo.PIC6 == "")
                        {
                            objCarPicInfo.PIC6 = picId;
                        }
                        else if (objCarPicInfo.PIC7 == null || objCarPicInfo.PIC7 == "")
                        {
                            objCarPicInfo.PIC7 = picId;
                        }
                        else if (objCarPicInfo.PIC8 == null || objCarPicInfo.PIC8 == "")
                        {
                            objCarPicInfo.PIC8 = picId;
                        }
                        else if (objCarPicInfo.PIC9 == null || objCarPicInfo.PIC9 == "")
                        {
                            objCarPicInfo.PIC9 = picId;
                        }
                        else if (objCarPicInfo.PIC10 == null || objCarPicInfo.PIC10 == "")
                        {
                            objCarPicInfo.PIC10 = picId;
                        }
                        else if (objCarPicInfo.PIC11 == null || objCarPicInfo.PIC11 == "")
                        {
                            objCarPicInfo.PIC11 = picId;
                        }
                        else if (objCarPicInfo.PIC12 == null || objCarPicInfo.PIC12 == "")
                        {
                            objCarPicInfo.PIC12 = picId;
                        }
                        else if (objCarPicInfo.PIC13 == null || objCarPicInfo.PIC13 == "")
                        {
                            objCarPicInfo.PIC13 = picId;
                        }
                        else if (objCarPicInfo.PIC14 == null || objCarPicInfo.PIC14 == "")
                        {
                            objCarPicInfo.PIC14 = picId;
                        }
                        else if (objCarPicInfo.PIC15 == null || objCarPicInfo.PIC15 == "")
                        {
                            objCarPicInfo.PIC15 = picId;
                        }
                        else if (objCarPicInfo.PIC16 == null || objCarPicInfo.PIC16 == "")
                        {
                            objCarPicInfo.PIC16 = picId;
                        }
                        else if (objCarPicInfo.PIC17 == null || objCarPicInfo.PIC17 == "")
                        {
                            objCarPicInfo.PIC17 = picId;
                        }
                        else if (objCarPicInfo.PIC18 == null || objCarPicInfo.PIC18 == "")
                        {
                            objCarPicInfo.PIC18 = picId;
                        }
                        else if (objCarPicInfo.PIC19 == null || objCarPicInfo.PIC19 == "")
                        {
                            objCarPicInfo.PIC19 = picId;
                        }
                        else if (objCarPicInfo.PIC20 == null || objCarPicInfo.PIC19 == "")
                        {
                            objCarPicInfo.PIC20 = picId;
                        }

                        objDealer.UpdatePicturesByIdFromDealerSite(objCarPicInfo, UserID);

                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Example #14
0
    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;
        //
    }
Example #15
0
    public List<CarsInfo.UsedCarsInfo> GetCarsFilterMulti(ArrayList AFilter, int PageResultsCount)
    {
        //List<CarsInfo.UsedCarsInfo> obj = null;
        Session["FilterArray"] = AFilter;

        CarsBL.UsedCarsSearch objCarsearch = new CarsBL.UsedCarsSearch();

        List<CarsInfo.UsedCarsInfo> obAddedItems = new List<CarsInfo.UsedCarsInfo>();

        List<CarsInfo.UsedCarsInfo> objMileage = new List<CarsInfo.UsedCarsInfo>();
        List<CarsInfo.UsedCarsInfo> objYear = new List<CarsInfo.UsedCarsInfo>();
        List<CarsInfo.UsedCarsInfo> objPrice = new List<CarsInfo.UsedCarsInfo>();
        List<CarsInfo.UsedCarsInfo> objBodytype = new List<CarsInfo.UsedCarsInfo>();
        List<CarsInfo.UsedCarsInfo> objFuelType = new List<CarsInfo.UsedCarsInfo>();
        List<CarsInfo.UsedCarsInfo> objSellerType = new List<CarsInfo.UsedCarsInfo>();

        Filter objFilter = new Filter();
        string carMakeid = string.Empty;
        string CarModalId = string.Empty;
        string ZipCode = string.Empty;
        string WithinZip = string.Empty;
        //Session["Orderby"] = Orderby;
        carMakeid = Session["carMake"].ToString();
        CarModalId = Session["CarModalId"].ToString();
        ZipCode = Session["ZipCode"].ToString();
        WithinZip = Session["WithinZip"].ToString();

        List<CarsInfo.UsedCarsInfo> objUsedCarsInfo = (List<CarsInfo.UsedCarsInfo>)Session["SearchFullCarsdata"];

        ///objUsedCarsInfo = (List<CarsInfo.UsedCarsInfo>)objCarsearch.SearchMultiUsedCars(carMakeid, CarModalId, ZipCode, WithinZip, "1", "25", "Price");

        CarsInfo.UsedCarsInfo OBJ = new CarsInfo.UsedCarsInfo();

        List<CarsInfo.UsedCarsInfo> objFilterdata = new List<CarsInfo.UsedCarsInfo>();

        for (int i = 0; i < AFilter.Count; i++)
        {

            //objMileage = objFilter.FilterData(obj, arr[i].ToString());

            switch (AFilter[i].ToString())
            {
                case "Mileage1":

                    objMileage = objUsedCarsInfo.FindAll(x => Convert.ToDecimal(x.Mileage) < Convert.ToDecimal(5000));
                    obAddedItems = objMileage;

                    break;

                case "Mileage2":

                    objMileage = objUsedCarsInfo.FindAll(x => Convert.ToDecimal(x.Mileage) >= 5000 && Convert.ToDecimal(x.Mileage) < 10000);
                    obAddedItems.AddRange(objMileage);
                    //obAddedItems.AddRange(objMileage[0]);

                    break;

                case "Mileage3":

                    objMileage = objUsedCarsInfo.FindAll(x => Convert.ToDecimal(x.Mileage) >= 10000 && Convert.ToDecimal(x.Mileage) < 25000);
                    obAddedItems.AddRange(objMileage);
                    break;

                case "Mileage4":
                    objMileage = objUsedCarsInfo.FindAll(x => Convert.ToDecimal(x.Mileage) >= 25000 && Convert.ToDecimal(x.Mileage) < 50000);
                    obAddedItems.AddRange(objMileage);
                    break;

                case "Mileage5":
                    objMileage = objUsedCarsInfo.FindAll(x => Convert.ToDecimal(x.Mileage) >= 50000 && Convert.ToDecimal(x.Mileage) < 75000);
                    obAddedItems.AddRange(objMileage);

                    break;

                case "Mileage6":

                    objMileage = objUsedCarsInfo.FindAll(x => Convert.ToDecimal(x.Mileage) >= 75000 && Convert.ToDecimal(x.Mileage) < 100000);
                    obAddedItems.AddRange(objMileage);
                    break;

                case "Mileage7":

                    objMileage = objUsedCarsInfo.FindAll(x => Convert.ToDecimal(x.Mileage) >= 100000);
                    obAddedItems.AddRange(objMileage);
                    break;//--30
                case "Year1a":

                    //if (obAddedItems.Count == 0)
                    //{
                    //    objFilterdata = objUsedCarsInfo.FindAll(x => Convert.ToInt32(x.YearOfMake) == 2011);
                    //    objYear.AddRange(objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = obAddedItems.FindAll(x => Convert.ToInt32(x.YearOfMake) == 2013);
                        objYear.AddRange(objFilterdata);
                    }
                    break;

                case "Year1b":

                    //if (obAddedItems.Count == 0)
                    //{
                    //    objFilterdata = objUsedCarsInfo.FindAll(x => Convert.ToInt32(x.YearOfMake) == 2011);
                    //    objYear.AddRange(objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = obAddedItems.FindAll(x => Convert.ToInt32(x.YearOfMake) == 2012);
                        objYear.AddRange(objFilterdata);
                    }

                    //objYear = objUsedCarsInfoFiltered;

                    break;

                case "Year1":

                    //if (obAddedItems.Count == 0)
                    //{
                    //    objFilterdata = objUsedCarsInfo.FindAll(x => Convert.ToInt32(x.YearOfMake) == 2011);
                    //    objYear.AddRange(objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = obAddedItems.FindAll(x => Convert.ToInt32(x.YearOfMake) == 2011);
                        objYear.AddRange(objFilterdata);
                    }

                    //objYear = objUsedCarsInfoFiltered;

                    break;

                case "Year2":
                    //if (obAddedItems.Count == 0)
                    //{
                    //    objFilterdata = objUsedCarsInfo.FindAll(x => Convert.ToInt32(x.YearOfMake) == 2010);
                    //    objYear.AddRange(objFilterdata);

                    //}
                    //else
                    {
                        objFilterdata = obAddedItems.FindAll(x => Convert.ToInt32(x.YearOfMake) == 2010);
                        objYear.AddRange(objFilterdata);
                    }

                    //obAddedItems = Additem(objYear);
                    break;

                case "Year3":
                    //if (obAddedItems.Count == 0)
                    //{
                    //    objFilterdata = objUsedCarsInfo.FindAll(x => Convert.ToInt32(x.YearOfMake) == 2009);
                    //    objYear.AddRange(objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = obAddedItems.FindAll(x => Convert.ToInt32(x.YearOfMake) == 2009);
                        objYear.AddRange(objFilterdata);
                    }

                    break;

                case "Year4":
                    //if (obAddedItems.Count == 0)
                    //{
                    //    objFilterdata = objUsedCarsInfo.FindAll(x => Convert.ToInt32(x.YearOfMake) == 2008);
                    //    objYear.AddRange(objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = obAddedItems.FindAll(x => Convert.ToInt32(x.YearOfMake) == 2008);
                        objYear.AddRange(objFilterdata);
                    }
                    break;

                case "Year5":
                    //if (obAddedItems.Count == 0)
                    //{
                    //    objFilterdata = objUsedCarsInfo.FindAll(x => Convert.ToInt32(x.YearOfMake) == 2007);
                    //    objYear.AddRange(objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = obAddedItems.FindAll(x => Convert.ToInt32(x.YearOfMake) == 2007);
                        objYear.AddRange(objFilterdata);
                    }
                    break;

                case "Year6":
                    //if (obAddedItems.Count == 0)
                    //{
                    //    objFilterdata = objUsedCarsInfo.FindAll(x => Convert.ToInt32(x.YearOfMake) >= 2002 && Convert.ToInt32(x.YearOfMake) <= 2006);
                    //    objYear.AddRange(objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = obAddedItems.FindAll(x => Convert.ToInt32(x.YearOfMake) >= 2002 && Convert.ToInt32(x.YearOfMake) <= 2006);
                        objYear.AddRange(objFilterdata);
                    }

                    break;

                case "Year7":

                    //if (obAddedItems.Count == 0)
                    //{
                    //    objFilterdata = objUsedCarsInfo.FindAll(x => Convert.ToInt32(x.YearOfMake) < 2002);
                    //    objYear.AddRange(objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = obAddedItems.FindAll(x => Convert.ToInt32(x.YearOfMake) < 2002);
                        objYear.AddRange(objFilterdata);
                    }

                    break;

                case "Price1":

                    //if (objYear.Count == 0)
                    //{
                    //    objFilterdata = objUsedCarsInfo.FindAll(x => Convert.ToDecimal(x.Price) < 20000);
                    //    objPrice.AddRange(objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = objYear.FindAll(x => Convert.ToDecimal(x.Price) < 20000);
                        objPrice.AddRange(objFilterdata);
                    }

                    break;

                case "Price2":

                    //if (objYear.Count == 0)
                    //{
                    //    objFilterdata = objUsedCarsInfo.FindAll(x => Convert.ToDecimal(x.Price) >= 20000 && Convert.ToDecimal(x.Price) < 50000);
                    //    objPrice.AddRange(objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = objYear.FindAll(x => Convert.ToDecimal(x.Price) >= 20000 && Convert.ToDecimal(x.Price) < 50000);
                        objPrice.AddRange(objFilterdata);

                    }

                    break;

                case "Price3":
                    //if (objYear.Count == 0)
                    //{
                    //    objFilterdata = objUsedCarsInfo.FindAll(x => Convert.ToDecimal(x.Price) >= 50000 && Convert.ToDecimal(x.Price) < 75000);
                    //    objPrice.AddRange(objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = objYear.FindAll(x => Convert.ToDecimal(x.Price) >= 50000 && Convert.ToDecimal(x.Price) < 75000);
                        objPrice.AddRange(objFilterdata);
                    }

                    break;

                case "Price4":
                    if (objYear.Count == 0)
                    //{

                    //    objFilterdata = objUsedCarsInfo.FindAll(x => Convert.ToDecimal(x.Price) >= 75000 && Convert.ToDecimal(x.Price) < 100000);
                    //    objPrice.AddRange(objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = objYear.FindAll(x => Convert.ToDecimal(x.Price) >= 75000 && Convert.ToDecimal(x.Price) < 100000);
                        objPrice.AddRange(objFilterdata);
                    }

                    break;

                case "Price5":
                    //if (objYear.Count == 0)
                    //{
                    //    objFilterdata = objUsedCarsInfo.FindAll(x => Convert.ToDecimal(x.Price) >= 100000);
                    //    objPrice = objFilterdata;
                    //}
                    //else
                    {
                        objFilterdata = objYear.FindAll(x => Convert.ToDecimal(x.Price) >= 100000);
                        objPrice.AddRange(objFilterdata);
                    }

                    break;

                case "Body1":
                    //if (objPrice.Count == 0)
                    //{
                    //    objFilterdata = objUsedCarsInfo.FindAll(x => (x.Bodytype.Trim()) == "Convertible");
                    //    objBodytype.AddRange(objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = objPrice.FindAll(x => (x.Bodytype.Trim()) == "Convertible");
                        objBodytype.AddRange(objFilterdata);
                    }
                    break;

                case "Body2":
                    //if (objPrice.Count == 0)
                    //{
                    //    objFilterdata = objUsedCarsInfo.FindAll(x => (x.Bodytype.Trim()) == "Coupe");
                    //    objBodytype.AddRange(objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = objPrice.FindAll(x => (x.Bodytype.Trim()) == "Coupe");
                        objBodytype.AddRange(objFilterdata);
                    }

                    break;

                case "Body3":
                    //if (objPrice.Count == 0)
                    //{

                    //    objFilterdata = objUsedCarsInfo.FindAll(x => (x.Bodytype.Trim()) == "Hatchback");
                    //    objBodytype.AddRange(objFilterdata);
                    //}
                    // else
                    {
                        objFilterdata = objPrice.FindAll(x => (x.Bodytype.Trim()) == "Hatchback");
                        objBodytype.AddRange(objFilterdata);
                    }

                    break;

                case "Body4":
                    //if (objPrice.Count == 0)
                    //{

                    //    objFilterdata = objUsedCarsInfo.FindAll(x => (x.Bodytype.Trim()) == "Sedan");
                    //    objBodytype.AddRange(objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = objPrice.FindAll(x => (x.Bodytype.Trim()) == "Sedan");
                        objBodytype.AddRange(objFilterdata);
                    }
                    break;

                case "Body5":
                    //if (objPrice.Count == 0)
                    //{

                    //    objFilterdata = objUsedCarsInfo.FindAll(x => (x.Bodytype.Trim()) == "SUV");
                    //    objBodytype.AddRange(objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = objPrice.FindAll(x => (x.Bodytype.Trim()) == "SUV");
                        objBodytype.AddRange(objFilterdata);
                    }

                    break;

                case "Body6":

                    //if (objPrice.Count == 0)
                    //{

                    //    objFilterdata = objUsedCarsInfo.FindAll(x => (x.Bodytype.Trim()) == "Truck");
                    //    objBodytype.AddRange(objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = objPrice.FindAll(x => (x.Bodytype.Trim()) == "Truck");
                        objBodytype.AddRange(objFilterdata);
                    }

                    break;

                case "Body7":

                    //if (objPrice.Count == 0)
                    //{

                    //    objFilterdata = objUsedCarsInfo.FindAll(x => (x.Bodytype.Trim()) == "Van");
                    //    objBodytype.AddRange(objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = objPrice.FindAll(x => (x.Bodytype.Trim()) == "Van");
                        objBodytype.AddRange(objFilterdata);
                    }

                    break;

                case "Body8":

                    //if (objPrice.Count == 0)
                    //{

                    //    objFilterdata = objUsedCarsInfo.FindAll(x => (x.Bodytype.Trim()) == "Wagon");
                    //    objBodytype.AddRange(objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = objPrice.FindAll(x => (x.Bodytype.Trim()) == "Wagon");
                        objBodytype.AddRange(objFilterdata);
                    }

                    break;

                case "Body9":

                    //if (objPrice.Count == 0)
                    //{

                    //    objFilterdata = objUsedCarsInfo.FindAll(x => (x.Bodytype.Trim()) == "Other");
                    //    objBodytype.AddRange(objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = objPrice.FindAll(x => (x.Bodytype.Trim()) == "Other");
                        objBodytype.AddRange(objFilterdata);
                    }

                    break;

                case "Fuel1":
                    //if (objBodytype.Count == 0)
                    //{
                    //    objFilterdata = objUsedCarsInfo.FindAll(x => (x.Fueltype.Trim()) == "Diesel");
                    //    objFuelType.AddRange(objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = objBodytype.FindAll(x => (x.Fueltype.Trim()) == "Diesel");
                        objFuelType.AddRange(objFilterdata);
                    }
                    break;

                case "Fuel2":
                    //if (objBodytype.Count == 0)
                    //{
                    //    objFilterdata = objUsedCarsInfo.FindAll(x => (x.Fueltype.Trim()) == "Petrol");
                    //    objFuelType.AddRange(objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = objBodytype.FindAll(x => (x.Fueltype.Trim()) == "Petrol");
                        objFuelType.AddRange(objFilterdata);
                    }
                    //objFilterdata = objBodytype.FindAll(x => (x.Fueltype.Trim()) == "Petrol");

                    break;

                case "Fuel3":
                    //if (objBodytype.Count == 0)
                    //{
                    //    objFilterdata = objUsedCarsInfo.FindAll(x => (x.Fueltype.Trim()) == "Hybrid");
                    //    objFuelType.AddRange(objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = objBodytype.FindAll(x => (x.Fueltype.Trim()) == "Hybrid");
                        objFuelType.AddRange(objFilterdata);
                    }

                    break;
                case "Fuel4":

                    //if (objBodytype.Count == 0)
                    //{
                    //    objFilterdata = objUsedCarsInfo.FindAll(x => (x.Fueltype.Trim()) == "Electric");
                    //    objFuelType.AddRange(objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = objBodytype.FindAll(x => (x.Fueltype.Trim()) == "Electric");
                        objFuelType.AddRange(objFilterdata);
                    }

                    //objFuelType.AddRange(objFilterdata);
                    break;

                case "Fuel5":

                    //if (objBodytype.Count == 0)
                    //{
                    //    objFilterdata = objUsedCarsInfo.FindAll(x => (x.Fueltype.Trim()) == "Other");
                    //    objFuelType.AddRange(objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = objBodytype.FindAll(x => (x.Fueltype.Trim()) == "Other");
                        objFuelType.AddRange(objFilterdata);
                    }

                    break;

                case "Seller1":
                    //if (objBodytype.Count == 0)
                    //{
                    //    objFilterdata = objUsedCarsInfo.FindAll(x => (x.SellerType.Trim()) == "Invidual");

                    //    objSellerType .AddRange( objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = objFuelType.FindAll(x => (x.SellerType.Trim()) == "Private Seller");

                        objSellerType.AddRange(objFilterdata);
                    }

                    break;

                case "Seller2":
                    //if (objBodytype.Count == 0)
                    //{
                    //    objFilterdata = objUsedCarsInfo.FindAll(x => (x.SellerType.Trim()) == "Dealers");

                    //    objSellerType .AddRange( objFilterdata);
                    //}
                    //else
                    {
                        objFilterdata = objFuelType.FindAll(x => (x.SellerType.Trim()) == "Dealers");

                        objSellerType.AddRange(objFilterdata);
                    }

                    //objFilterdata = objFuelType.FindAll(x => (x.SellerType.Trim()) == "");

                    break;
            };
            //objMileage
        }
        Session["SearchCarsdata"] = objSellerType;

        //if (Session["SortType"] != null)
        //{
        //    objSellerType = SortData(Session["SortType"].ToString(), PageResultsCount);
        //}

        //objSellerType = pagingdata(PageResultsCount, 1, objSellerType);

        return objSellerType;
        //
    }
    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;
    }
Example #17
0
    public string UploadPictureByCarIDFromAndroid(string CarID, string make, string model, string year, string UserID, string pic, string AuthenticationID, string CustomerID, string SessionID)
    {
        string bStatus = "Failed";
        MobileBL objMobile = new MobileBL();
        UsedCarsInfo objCarPicInfo = new UsedCarsInfo();

        try
        {
            if (CustomerID != "")
            {
                string parameters = CarID + "," + make + "," + model + "," + year + "," + UserID;
                DataSet dsSaveCustInfo = objMobile.SaveMobileCustomerInfo("UploadPictureByCarID", CustomerID, AuthenticationID, parameters);
            }
            bool bnew = objMobile.CheckMobileAuthorizeUSer(SessionID, Convert.ToInt32(UserID));
            if (bnew)
            {
                try
                {
                    if (AuthenticationID == ConfigurationManager.AppSettings["AppleID"].ToString())
                    {
                        objCarPicInfo.Carid = Convert.ToInt32(CarID);
                        byte[] picContent = Convert.FromBase64String(pic);
                        MemoryStream ms = new MemoryStream(picContent);

                        System.Drawing.Bitmap oBitmap1 = new System.Drawing.Bitmap(ms);

                        DataSet dsImagesData = objMobile.GetMobileCarPicIDs(Convert.ToInt32(CarID));

                        string FileNameFullLocation = "CarImages" + "/" + year.ToString() + "/" + make.ToString() + "/" + model + "/";
                        string FileNameFullThumb = "CarImages" + "/" + year.ToString() + "/" + make.ToString() + "/" + model + "/";
                        string FileLocatinon = "MobileService/CarImages" + "/" + year.ToString() + "/" + make.ToString() + "/" + model + "/";
                        string FileName = string.Empty;
                        if (dsImagesData.Tables.Count > 0)
                        {
                            if (dsImagesData.Tables[0].Rows.Count > 0)
                            {
                                objCarPicInfo.PIC0 = dsImagesData.Tables[0].Rows[0]["pic0"].ToString() == "" ? null : dsImagesData.Tables[0].Rows[0]["pic0"].ToString();
                                objCarPicInfo.PIC1 = dsImagesData.Tables[0].Rows[0]["pic1"].ToString() == "" ? null : dsImagesData.Tables[0].Rows[0]["pic1"].ToString();
                                objCarPicInfo.PIC2 = dsImagesData.Tables[0].Rows[0]["pic2"].ToString() == "" ? null : dsImagesData.Tables[0].Rows[0]["pic2"].ToString();
                                objCarPicInfo.PIC3 = dsImagesData.Tables[0].Rows[0]["pic3"].ToString() == "" ? null : dsImagesData.Tables[0].Rows[0]["pic3"].ToString();
                                objCarPicInfo.PIC4 = dsImagesData.Tables[0].Rows[0]["pic4"].ToString() == "" ? null : dsImagesData.Tables[0].Rows[0]["pic4"].ToString();
                                objCarPicInfo.PIC5 = dsImagesData.Tables[0].Rows[0]["pic5"].ToString() == "" ? null : dsImagesData.Tables[0].Rows[0]["pic5"].ToString();
                                objCarPicInfo.PIC6 = dsImagesData.Tables[0].Rows[0]["pic6"].ToString() == "" ? null : dsImagesData.Tables[0].Rows[0]["pic6"].ToString();
                                objCarPicInfo.PIC7 = dsImagesData.Tables[0].Rows[0]["pic7"].ToString() == "" ? null : dsImagesData.Tables[0].Rows[0]["pic7"].ToString();
                                objCarPicInfo.PIC8 = dsImagesData.Tables[0].Rows[0]["pic8"].ToString() == "" ? null : dsImagesData.Tables[0].Rows[0]["pic8"].ToString();
                                objCarPicInfo.PIC9 = dsImagesData.Tables[0].Rows[0]["pic9"].ToString() == "" ? null : dsImagesData.Tables[0].Rows[0]["pic9"].ToString();
                                objCarPicInfo.PIC10 = dsImagesData.Tables[0].Rows[0]["pic10"].ToString() == "" ? null : dsImagesData.Tables[0].Rows[0]["pic10"].ToString();
                                objCarPicInfo.PIC11 = dsImagesData.Tables[0].Rows[0]["pic11"].ToString() == "" ? null : dsImagesData.Tables[0].Rows[0]["pic11"].ToString();
                                objCarPicInfo.PIC12 = dsImagesData.Tables[0].Rows[0]["pic12"].ToString() == "" ? null : dsImagesData.Tables[0].Rows[0]["pic12"].ToString();
                                objCarPicInfo.PIC13 = dsImagesData.Tables[0].Rows[0]["pic13"].ToString() == "" ? null : dsImagesData.Tables[0].Rows[0]["pic13"].ToString();
                                objCarPicInfo.PIC14 = dsImagesData.Tables[0].Rows[0]["pic14"].ToString() == "" ? null : dsImagesData.Tables[0].Rows[0]["pic14"].ToString();
                                objCarPicInfo.PIC15 = dsImagesData.Tables[0].Rows[0]["pic15"].ToString() == "" ? null : dsImagesData.Tables[0].Rows[0]["pic15"].ToString();
                                objCarPicInfo.PIC16 = dsImagesData.Tables[0].Rows[0]["pic16"].ToString() == "" ? null : dsImagesData.Tables[0].Rows[0]["pic16"].ToString();
                                objCarPicInfo.PIC17 = dsImagesData.Tables[0].Rows[0]["pic17"].ToString() == "" ? null : dsImagesData.Tables[0].Rows[0]["pic17"].ToString();
                                objCarPicInfo.PIC18 = dsImagesData.Tables[0].Rows[0]["pic18"].ToString() == "" ? null : dsImagesData.Tables[0].Rows[0]["pic18"].ToString();
                                objCarPicInfo.PIC19 = dsImagesData.Tables[0].Rows[0]["pic19"].ToString() == "" ? null : dsImagesData.Tables[0].Rows[0]["pic19"].ToString();
                                objCarPicInfo.PIC20 = dsImagesData.Tables[0].Rows[0]["pic20"].ToString() == "" ? null : dsImagesData.Tables[0].Rows[0]["pic20"].ToString();

                                //******************Creating bigImage***************************

                                if (objCarPicInfo.PIC1 == "0" || objCarPicInfo.PIC1 == null || objCarPicInfo.PIC1 == "" || objCarPicInfo.PIC1 == " ")
                                {
                                    FileName = year.ToString() + "_" + make + "_" + model + "_" + CarID + "_Image1.Jpeg";
                                }
                                else if (objCarPicInfo.PIC2 == "0" || objCarPicInfo.PIC2 == null || objCarPicInfo.PIC2 == "" || objCarPicInfo.PIC2 == " ")
                                {
                                    FileName = year.ToString() + "_" + make + "_" + model + "_" + CarID + "_Image2.Jpeg";
                                }
                                else if (objCarPicInfo.PIC3 == "0" || objCarPicInfo.PIC3 == null || objCarPicInfo.PIC3 == "" || objCarPicInfo.PIC3 == " ")
                                {
                                    FileName = year.ToString() + "_" + make + "_" + model + "_" + CarID + "_Image3.Jpeg";
                                }
                                else if (objCarPicInfo.PIC4 == "0" || objCarPicInfo.PIC4 == null || objCarPicInfo.PIC4 == "" || objCarPicInfo.PIC4 == " ")
                                {
                                    FileName = year.ToString() + "_" + make + "_" + model + "_" + CarID + "_Image4.Jpeg";
                                }
                                else if (objCarPicInfo.PIC5 == "0" || objCarPicInfo.PIC5 == null || objCarPicInfo.PIC5 == "" || objCarPicInfo.PIC5 == " ")
                                {
                                    FileName = year.ToString() + "_" + make + "_" + model + "_" + CarID + "_Image5.Jpeg";
                                }
                                else if (objCarPicInfo.PIC6 == "0" || objCarPicInfo.PIC6 == null || objCarPicInfo.PIC6 == "" || objCarPicInfo.PIC6 == " ")
                                {
                                    FileName = year.ToString() + "_" + make + "_" + model + "_" + CarID + "_Image6.Jpeg";
                                }
                                else if (objCarPicInfo.PIC7 == "0" || objCarPicInfo.PIC7 == null || objCarPicInfo.PIC7 == "" || objCarPicInfo.PIC7 == " ")
                                {
                                    FileName = year.ToString() + "_" + make + "_" + model + "_" + CarID + "_Image7.Jpeg";
                                }
                                else if (objCarPicInfo.PIC8 == "0" || objCarPicInfo.PIC8 == null || objCarPicInfo.PIC8 == "" || objCarPicInfo.PIC8 == " ")
                                {
                                    FileName = year.ToString() + "_" + make + "_" + model + "_" + CarID + "_Image8.Jpeg";
                                }
                                else if (objCarPicInfo.PIC9 == "0" || objCarPicInfo.PIC9 == null || objCarPicInfo.PIC9 == "" || objCarPicInfo.PIC9 == " ")
                                {
                                    FileName = year.ToString() + "_" + make + "_" + model + "_" + CarID + "_Image9.Jpeg";
                                }

                                else if (objCarPicInfo.PIC10 == "0" || objCarPicInfo.PIC10 == null || objCarPicInfo.PIC10 == "" || objCarPicInfo.PIC10 == " ")
                                {
                                    FileName = year.ToString() + "_" + make + "_" + model + "_" + CarID + "_Image10.Jpeg";
                                }
                                else if (objCarPicInfo.PIC11 == "0" || objCarPicInfo.PIC11 == null || objCarPicInfo.PIC11 == "" || objCarPicInfo.PIC11 == " ")
                                {
                                    FileName = year.ToString() + "_" + make + "_" + model + "_" + CarID + "_Image11.Jpeg";
                                }
                                else if (objCarPicInfo.PIC12 == "0" || objCarPicInfo.PIC12 == null || objCarPicInfo.PIC12 == "" || objCarPicInfo.PIC12 == " ")
                                {
                                    FileName = year.ToString() + "_" + make + "_" + model + "_" + CarID + "_Image12.Jpeg";
                                }
                                else if (objCarPicInfo.PIC13 == "0" || objCarPicInfo.PIC13 == null || objCarPicInfo.PIC13 == "" || objCarPicInfo.PIC13 == " ")
                                {
                                    FileName = year.ToString() + "_" + make + "_" + model + "_" + CarID + "_Image13.Jpeg";
                                }
                                else if (objCarPicInfo.PIC14 == "0" || objCarPicInfo.PIC14 == null || objCarPicInfo.PIC14 == "" || objCarPicInfo.PIC14 == " ")
                                {
                                    FileName = year.ToString() + "_" + make + "_" + model + "_" + CarID + "_Image14.Jpeg";
                                }
                                else if (objCarPicInfo.PIC15 == "0" || objCarPicInfo.PIC15 == null || objCarPicInfo.PIC15 == "" || objCarPicInfo.PIC15 == " ")
                                {
                                    FileName = year.ToString() + "_" + make + "_" + model + "_" + CarID + "_Image15.Jpeg";
                                }
                                else if (objCarPicInfo.PIC16 == "0" || objCarPicInfo.PIC16 == null || objCarPicInfo.PIC16 == "" || objCarPicInfo.PIC16 == " ")
                                {
                                    FileName = year.ToString() + "_" + make + "_" + model + "_" + CarID + "_Image16.Jpeg";
                                }
                                else if (objCarPicInfo.PIC17 == "0" || objCarPicInfo.PIC17 == null || objCarPicInfo.PIC17 == "" || objCarPicInfo.PIC17 == " ")
                                {
                                    FileName = year.ToString() + "_" + make + "_" + model + "_" + CarID + "_Image17.Jpeg";
                                }
                                else if (objCarPicInfo.PIC18 == "0" || objCarPicInfo.PIC18 == null || objCarPicInfo.PIC18 == "" || objCarPicInfo.PIC18 == " ")
                                {
                                    FileName = year.ToString() + "_" + make + "_" + model + "_" + CarID + "_Image18.Jpeg";
                                }
                                else if (objCarPicInfo.PIC19 == "0" || objCarPicInfo.PIC19 == null || objCarPicInfo.PIC19 == "" || objCarPicInfo.PIC19 == " ")
                                {
                                    FileName = year.ToString() + "_" + make + "_" + model + "_" + CarID + "_Image19.Jpeg";
                                }
                                else if (objCarPicInfo.PIC20 == "0" || objCarPicInfo.PIC20 == null || objCarPicInfo.PIC20 == "" || objCarPicInfo.PIC20 == " ")
                                {
                                    FileName = year.ToString() + "_" + make + "_" + model + "_" + CarID + "_Image20.Jpeg";
                                }

                                string sFilePath = Server.MapPath(FileNameFullLocation);
                                if (System.IO.Directory.Exists(sFilePath) == false)
                                {
                                    System.IO.Directory.CreateDirectory(sFilePath);
                                }

                                Graphics oGraphic1 = default(Graphics);

                                int newwidthimg1 = 600;
                                // Here create a new bitmap object of the same height and width of the image.
                                float AspectRatio = (float)oBitmap1.Size.Width / (float)oBitmap1.Size.Height;
                                int newHeight1 = Convert.ToInt32(newwidthimg1 / AspectRatio);

                                Bitmap bmpNew1 = new Bitmap(newwidthimg1, newHeight1);
                                oGraphic1 = Graphics.FromImage(bmpNew1);

                                oGraphic1.CompositingQuality = CompositingQuality.HighQuality;
                                oGraphic1.SmoothingMode = SmoothingMode.HighQuality;
                                oGraphic1.InterpolationMode = InterpolationMode.HighQualityBicubic;

                                oGraphic1.DrawImage(oBitmap1, new Rectangle(0, 0, bmpNew1.Width, bmpNew1.Height), 0, 0, oBitmap1.Width, oBitmap1.Height, GraphicsUnit.Pixel);
                                // Release the lock on the image file. Of course,
                                // image from the image file is existing in Graphics object
                                oBitmap1.Dispose();
                                oBitmap1 = bmpNew1;

                                oBitmap1.Save(sFilePath + "/" + FileName, ImageFormat.Jpeg);

                                oBitmap1.Dispose();

                                string picID = objMobile.SaveMobileCarPicture(FileLocatinon, "Jpeg", FileName, Convert.ToInt32(UserID));

                                if (objCarPicInfo.PIC1 == "0" || objCarPicInfo.PIC1 == null || objCarPicInfo.PIC1 == "" || objCarPicInfo.PIC1 == " ")
                                {
                                    objCarPicInfo.PIC1 = picID;
                                }
                                else if (objCarPicInfo.PIC2 == "0" || objCarPicInfo.PIC2 == null || objCarPicInfo.PIC2 == "" || objCarPicInfo.PIC2 == " ")
                                {
                                    objCarPicInfo.PIC2 = picID;
                                }
                                else if (objCarPicInfo.PIC3 == "0" || objCarPicInfo.PIC3 == null || objCarPicInfo.PIC3 == "" || objCarPicInfo.PIC3 == " ")
                                {
                                    objCarPicInfo.PIC3 = picID;
                                }
                                else if (objCarPicInfo.PIC4 == "0" || objCarPicInfo.PIC4 == null || objCarPicInfo.PIC4 == "" || objCarPicInfo.PIC4 == " ")
                                {
                                    objCarPicInfo.PIC4 = picID;
                                }
                                else if (objCarPicInfo.PIC5 == "0" || objCarPicInfo.PIC5 == null || objCarPicInfo.PIC5 == "" || objCarPicInfo.PIC5 == " ")
                                {
                                    objCarPicInfo.PIC5 = picID;
                                }
                                else if (objCarPicInfo.PIC6 == "0" || objCarPicInfo.PIC6 == null || objCarPicInfo.PIC6 == "" || objCarPicInfo.PIC6 == " ")
                                {
                                    objCarPicInfo.PIC6 = picID;
                                }
                                else if (objCarPicInfo.PIC7 == "0" || objCarPicInfo.PIC7 == null || objCarPicInfo.PIC7 == "" || objCarPicInfo.PIC7 == " ")
                                {
                                    objCarPicInfo.PIC7 = picID;
                                }
                                else if (objCarPicInfo.PIC8 == "0" || objCarPicInfo.PIC8 == null || objCarPicInfo.PIC8 == "" || objCarPicInfo.PIC8 == " ")
                                {
                                    objCarPicInfo.PIC8 = picID;
                                }
                                else if (objCarPicInfo.PIC9 == "0" || objCarPicInfo.PIC9 == null || objCarPicInfo.PIC9 == "" || objCarPicInfo.PIC9 == " ")
                                {
                                    objCarPicInfo.PIC9 = picID;
                                }

                                else if (objCarPicInfo.PIC10 == "0" || objCarPicInfo.PIC10 == null || objCarPicInfo.PIC10 == "" || objCarPicInfo.PIC10 == " ")
                                {
                                    objCarPicInfo.PIC10 = picID;
                                }
                                else if (objCarPicInfo.PIC11 == "0" || objCarPicInfo.PIC11 == null || objCarPicInfo.PIC11 == "" || objCarPicInfo.PIC11 == " ")
                                {
                                    objCarPicInfo.PIC11 = picID;
                                }
                                else if (objCarPicInfo.PIC12 == "0" || objCarPicInfo.PIC12 == null || objCarPicInfo.PIC12 == "" || objCarPicInfo.PIC12 == " ")
                                {
                                    objCarPicInfo.PIC12 = picID;
                                }
                                else if (objCarPicInfo.PIC13 == "0" || objCarPicInfo.PIC13 == null || objCarPicInfo.PIC13 == "" || objCarPicInfo.PIC13 == " ")
                                {
                                    objCarPicInfo.PIC13 = picID;
                                }
                                else if (objCarPicInfo.PIC14 == "0" || objCarPicInfo.PIC14 == null || objCarPicInfo.PIC14 == "" || objCarPicInfo.PIC14 == " ")
                                {
                                    objCarPicInfo.PIC14 = picID;
                                }
                                else if (objCarPicInfo.PIC15 == "0" || objCarPicInfo.PIC15 == null || objCarPicInfo.PIC15 == "" || objCarPicInfo.PIC15 == " ")
                                {
                                    objCarPicInfo.PIC15 = picID;
                                }
                                else if (objCarPicInfo.PIC16 == "0" || objCarPicInfo.PIC16 == null || objCarPicInfo.PIC16 == "" || objCarPicInfo.PIC16 == " ")
                                {
                                    objCarPicInfo.PIC16 = picID;
                                }
                                else if (objCarPicInfo.PIC17 == "0" || objCarPicInfo.PIC17 == null || objCarPicInfo.PIC17 == "" || objCarPicInfo.PIC17 == " ")
                                {
                                    objCarPicInfo.PIC17 = picID;
                                }
                                else if (objCarPicInfo.PIC18 == "0" || objCarPicInfo.PIC18 == null || objCarPicInfo.PIC18 == "" || objCarPicInfo.PIC18 == " ")
                                {
                                    objCarPicInfo.PIC18 = picID;
                                }
                                else if (objCarPicInfo.PIC19 == "0" || objCarPicInfo.PIC19 == null || objCarPicInfo.PIC19 == "" || objCarPicInfo.PIC19 == " ")
                                {
                                    objCarPicInfo.PIC19 = picID;
                                }
                                else if (objCarPicInfo.PIC20 == "0" || objCarPicInfo.PIC20 == null || objCarPicInfo.PIC20 == "" || objCarPicInfo.PIC20 == " ")
                                {
                                    objCarPicInfo.PIC20 = picID;
                                }

                                if (objCarPicInfo.PIC0 == "0" || objCarPicInfo.PIC0 == null || objCarPicInfo.PIC0 == "" || objCarPicInfo.PIC0 == " ")
                                {

                                    System.Drawing.Bitmap oBitmap = new System.Drawing.Bitmap(ms);

                                    string sFilePath1 = Server.MapPath(FileNameFullThumb);
                                    string FileNameThumb = year.ToString() + "_" + make + "_" + model + "_" + CarID + "Thumb.Jpeg";
                                    if (System.IO.Directory.Exists(sFilePath1) == false)
                                    {
                                        System.IO.Directory.CreateDirectory(sFilePath1);
                                    }

                                    Graphics oGraphic = default(Graphics);

                                    int newwidthimg = 250;
                                    // Here create a new bitmap object of the same height and width of the image.
                                    float AspectRatio1 = (float)oBitmap.Size.Width / (float)oBitmap.Size.Height;
                                    int newHeight = Convert.ToInt32(newwidthimg / AspectRatio);

                                    Bitmap bmpNew = new Bitmap(newwidthimg, newHeight);
                                    oGraphic = Graphics.FromImage(bmpNew);

                                    oGraphic.CompositingQuality = CompositingQuality.HighQuality;
                                    oGraphic.SmoothingMode = SmoothingMode.HighQuality;
                                    oGraphic.InterpolationMode = InterpolationMode.HighQualityBicubic;

                                    oGraphic.DrawImage(oBitmap, new Rectangle(0, 0, bmpNew.Width, bmpNew.Height), 0, 0, oBitmap.Width, oBitmap.Height, GraphicsUnit.Pixel);
                                    // Release the lock on the image file. Of course,
                                    // image from the image file is existing in Graphics object
                                    oBitmap.Dispose();
                                    oBitmap = bmpNew;

                                    oBitmap.Save(sFilePath1 + "/" + FileNameThumb, ImageFormat.Jpeg);

                                    oBitmap.Dispose();

                                    string picIDs = objMobile.SaveMobileCarPicture(FileLocatinon, "Jpeg", FileNameThumb, Convert.ToInt32(UserID));
                                    objCarPicInfo.PIC0 = picIDs;
                                }

                                bool bnw = objMobile.UpdateMobilePicturesByCarId(objCarPicInfo);
                                if (bnw)
                                {
                                    bStatus = "Success";
                                }

                            }

                        }
                    }
                }
                catch (Exception ex)
                {

                }
            }
        }
        catch (Exception ex)
        {
        }

        return bStatus;
    }
        public IList<UsedCarsInfo> GetDealersSearchCarsNew(string carMakeid, string CarModalId, string YearID, string PriceOrderby,
            string MarginRangeOrderby, string NoofDayActive, string AdStatus, string CarActive, string VehicleTypeTrim,
            string InventoryID,
            string DealerCode)
        {
            ///objUsedCars.Decalaring CarsInfo division object collection
            IList<UsedCarsInfo> UsedCarsIList = new List<UsedCarsInfo>();

            string spNameString = string.Empty;

            IDataReader UsedCarsDataReader = null;

            //objUsedCars.Connect to the database
            Database dbDatabase = DatabaseFactory.CreateDatabase(Global.INSTANCE_NAME);

            spNameString = "USP_Dealers_SearchCarsNew";
            DbCommand dbCommand = null;

            try
            {
                //objUsedCars.Set stored procedure to the command object
                dbCommand = dbDatabase.GetStoredProcCommand(spNameString);
                dbCommand.CommandTimeout = 10000;

                dbDatabase.AddInParameter(dbCommand, "@makeID", DbType.String, carMakeid);
                dbDatabase.AddInParameter(dbCommand, "@makeModelID", DbType.String, CarModalId);
                dbDatabase.AddInParameter(dbCommand, "@YearID", DbType.Int64, YearID);
                dbDatabase.AddInParameter(dbCommand, "@PriceOrderby", DbType.String, PriceOrderby);
                dbDatabase.AddInParameter(dbCommand, "@MarginRangeOrderby", DbType.String, MarginRangeOrderby);
                dbDatabase.AddInParameter(dbCommand, "@NoofDayActive", DbType.String, NoofDayActive);
                dbDatabase.AddInParameter(dbCommand, "@AdStatus", DbType.String, AdStatus);
                dbDatabase.AddInParameter(dbCommand, "@CarActive", DbType.String, CarActive);
                dbDatabase.AddInParameter(dbCommand, "@VehicleTypeTrim", DbType.String, VehicleTypeTrim);
                dbDatabase.AddInParameter(dbCommand, "@InventoryID", DbType.String, InventoryID);

                dbDatabase.AddInParameter(dbCommand, "@DealerCode", DbType.String, DealerCode);

                //objUsedCars.Executing stored procedure
                UsedCarsDataReader = dbDatabase.ExecuteReader(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 DataSet SaveCarAndSellerInfo(UsedCarsInfo objCarsInfo, string Description, string ConditionDescription, string Title, int TranBy,
            int UID, int PackageID, int PaymentID, int UserPackID, int PostingID, string Ip, string DealerCode)
        {
            try
            {
                DataSet dsCars = new DataSet();

                string spNameString = string.Empty;

                Database dbDatabase = DatabaseFactory.CreateDatabase(Global.INSTANCE_NAME);

                spNameString = "USP_SaveDealerCarAndSellerInfo";

                DbCommand dbCommand = null;
                dbCommand = dbDatabase.GetStoredProcCommand(spNameString);
                dbDatabase.AddInParameter(dbCommand, "@YearOfMake", System.Data.DbType.Int32, objCarsInfo.YearOfMake);
                dbDatabase.AddInParameter(dbCommand, "@MakeModelID", System.Data.DbType.Int32, objCarsInfo.MakeModelID);
                dbDatabase.AddInParameter(dbCommand, "@BodyTypeID", System.Data.DbType.Int32, objCarsInfo.BodytypeID);
                dbDatabase.AddInParameter(dbCommand, "@VehicleConditionID", System.Data.DbType.Int32, objCarsInfo.VehicleConditionID);
                dbDatabase.AddInParameter(dbCommand, "@DriveTrain", System.Data.DbType.String, objCarsInfo.DriveTrain);

                dbDatabase.AddInParameter(dbCommand, "@CarID", System.Data.DbType.Int32, objCarsInfo.Carid);
                dbDatabase.AddInParameter(dbCommand, "@Price", System.Data.DbType.String, objCarsInfo.Price);
                dbDatabase.AddInParameter(dbCommand, "@CurrentPrice", System.Data.DbType.String, objCarsInfo.CurrentPrice);
                dbDatabase.AddInParameter(dbCommand, "@PurchaseCost", System.Data.DbType.String, objCarsInfo.PurchaseCost);

                dbDatabase.AddInParameter(dbCommand, "@Mileage", System.Data.DbType.String, objCarsInfo.Mileage);
                dbDatabase.AddInParameter(dbCommand, "@ExteriorColor", System.Data.DbType.String, objCarsInfo.ExteriorColor);
                dbDatabase.AddInParameter(dbCommand, "@Transmission", System.Data.DbType.String, objCarsInfo.Transmission);
                dbDatabase.AddInParameter(dbCommand, "@InteriorColor", System.Data.DbType.String, objCarsInfo.InteriorColor);
                dbDatabase.AddInParameter(dbCommand, "@NumberOfDoors", System.Data.DbType.String, objCarsInfo.NumberOfDoors);

                dbDatabase.AddInParameter(dbCommand, "@VIN", System.Data.DbType.String, objCarsInfo.VIN);
                dbDatabase.AddInParameter(dbCommand, "@NumberOfCylinder", System.Data.DbType.String, objCarsInfo.NumberOfCylinder);
                dbDatabase.AddInParameter(dbCommand, "@FuelTypeID", System.Data.DbType.Int32, objCarsInfo.FueltypeId);
                dbDatabase.AddInParameter(dbCommand, "@Zipcode", System.Data.DbType.String, objCarsInfo.Zipcode);
                dbDatabase.AddInParameter(dbCommand, "@City", System.Data.DbType.String, objCarsInfo.City);

                dbDatabase.AddInParameter(dbCommand, "@StateID", System.Data.DbType.Int32, objCarsInfo.StateID);
                dbDatabase.AddInParameter(dbCommand, "@Description", System.Data.DbType.String, Description);
                dbDatabase.AddInParameter(dbCommand, "@ConditionDescription", System.Data.DbType.String, ConditionDescription);
                dbDatabase.AddInParameter(dbCommand, "@Title", System.Data.DbType.String, Title);
                dbDatabase.AddInParameter(dbCommand, "@TranBy", System.Data.DbType.Int32, TranBy);

                dbDatabase.AddInParameter(dbCommand, "@sellerName", System.Data.DbType.String, objCarsInfo.SellerName);
                dbDatabase.AddInParameter(dbCommand, "@address1", System.Data.DbType.String, objCarsInfo.Address1);
                dbDatabase.AddInParameter(dbCommand, "@state", System.Data.DbType.String, objCarsInfo.State);
                dbDatabase.AddInParameter(dbCommand, "@Zip", System.Data.DbType.String, objCarsInfo.Zip);
                dbDatabase.AddInParameter(dbCommand, "@Phone", System.Data.DbType.String, objCarsInfo.Phone);

                dbDatabase.AddInParameter(dbCommand, "@email", System.Data.DbType.String, objCarsInfo.Email);
                dbDatabase.AddInParameter(dbCommand, "@sellerID", System.Data.DbType.Int32, objCarsInfo.SellerID);
                dbDatabase.AddInParameter(dbCommand, "@UID", System.Data.DbType.Int32, UID);
                dbDatabase.AddInParameter(dbCommand, "@PackageID", System.Data.DbType.Int32, PackageID);
                dbDatabase.AddInParameter(dbCommand, "@PaymentID", System.Data.DbType.Int32, PaymentID);

                dbDatabase.AddInParameter(dbCommand, "@UserPackID", System.Data.DbType.Int32, UserPackID);
                dbDatabase.AddInParameter(dbCommand, "@PostingID", System.Data.DbType.Int32, PostingID);
                dbDatabase.AddInParameter(dbCommand, "@Ip", System.Data.DbType.String, Ip);
                dbDatabase.AddInParameter(dbCommand, "@AdStatus", System.Data.DbType.String, objCarsInfo.AdStatus);
                dbDatabase.AddInParameter(dbCommand, "@DealerCode", System.Data.DbType.String, DealerCode);
                dbDatabase.AddInParameter(dbCommand, "@DealerUniqueID", System.Data.DbType.String, objCarsInfo.DealerUniqueID);

                dsCars = dbDatabase.ExecuteDataSet(dbCommand);
                return dsCars;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #20
0
    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, 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   = 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();
        MobileBL   objMobileBL   = new MobileBL();

        if (CustomerID.Trim() != "")
        {
            string  parameter      = carMakeID + "," + CarModalId + "," + 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.FilterSearchMobile(objCarsFilter);
        }
        return(objFilterdata);
    }
        public DataSet USP_SaveSellerInfo(UsedCarsInfo objUsedCarsInfo, int CarID, int UID, int PackageID, int PaymentID, int UserPackID, int PostingID, string Ip)
        {
            try
            {
                bool bnew = false;
                DataSet dsCars = new DataSet();
                string spNameString = string.Empty;
                Database dbDatabase = DatabaseFactory.CreateDatabase(Global.INSTANCE_NAME);
                spNameString = "[USP_DealerSaveSellerInfo]";
                DbCommand dbCommand = null;
                dbCommand = dbDatabase.GetStoredProcCommand(spNameString);

                dbDatabase.AddInParameter(dbCommand, "@sellerID", System.Data.DbType.Int32, objUsedCarsInfo.SellerID);
                dbDatabase.AddInParameter(dbCommand, "@sellerName", System.Data.DbType.String, objUsedCarsInfo.SellerName);
                dbDatabase.AddInParameter(dbCommand, "@address1", System.Data.DbType.String, objUsedCarsInfo.Address1);
                dbDatabase.AddInParameter(dbCommand, "@city", System.Data.DbType.String, objUsedCarsInfo.City);
                dbDatabase.AddInParameter(dbCommand, "@state", System.Data.DbType.String, objUsedCarsInfo.State);
                dbDatabase.AddInParameter(dbCommand, "@Zip", System.Data.DbType.String, objUsedCarsInfo.Zip);
                dbDatabase.AddInParameter(dbCommand, "@Phone", System.Data.DbType.String, objUsedCarsInfo.Phone);
                dbDatabase.AddInParameter(dbCommand, "@email", System.Data.DbType.String, objUsedCarsInfo.Email);
                dbDatabase.AddInParameter(dbCommand, "@CarID", System.Data.DbType.Int32, CarID);
                dbDatabase.AddInParameter(dbCommand, "@UID", System.Data.DbType.Int32, UID);
                dbDatabase.AddInParameter(dbCommand, "@PackageID", System.Data.DbType.Int32, PackageID);
                dbDatabase.AddInParameter(dbCommand, "@PaymentID", System.Data.DbType.Int32, PaymentID);
                dbDatabase.AddInParameter(dbCommand, "@UserPackID", System.Data.DbType.Int32, UserPackID);
                dbDatabase.AddInParameter(dbCommand, "@PostingID", System.Data.DbType.Int32, PostingID);
                dbDatabase.AddInParameter(dbCommand, "@Ip", System.Data.DbType.String, Ip);

                dsCars = dbDatabase.ExecuteDataSet(dbCommand);
                return dsCars;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    private void SaveData()
    {
        UsedCarsInfo objcarsInfo = new UsedCarsInfo();
        DataSet ds = (DataSet)Session["ExcelData"];
        DealerActions objSaveCar = new DealerActions();

        try
        {
            int UID = Convert.ToInt32(Session[Constants.USER_ID].ToString());
            foreach (GridViewRow row in grdIntroInfo.Rows)
            {
                objcarsInfo.Make = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblMake")).Text).ToString();
                objcarsInfo.Model = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblModel")).Text).ToString();

                if (GenFunc.ExcelTextFormat(((Label)row.FindControl("lblPrice")).Text).ToString() == "")
                {
                    objcarsInfo.Price = Convert.ToDouble("0");
                }
                else
                {
                    objcarsInfo.Price = Convert.ToDouble(GenFunc.ExcelTextFormat(((Label)row.FindControl("lblPrice")).Text).ToString());
                }
                objcarsInfo.YearOfMake = Convert.ToInt32(GenFunc.ExcelTextFormat(((Label)row.FindControl("lblyear")).Text).ToString());
                objcarsInfo.Description = GenFunc.ExcelTextFormat(((HiddenField)row.FindControl("hdnDescription")).Value).ToString();
                if (GenFunc.ExcelTextFormat(((Label)row.FindControl("lblMileage")).Text).ToString().Replace("mi", "").Replace(",", "").Trim() == "")
                {
                    objcarsInfo.Mileage = "0";
                }
                else
                {
                    objcarsInfo.Mileage = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblMileage")).Text).ToString().Replace("mi", "").Replace(",", "").Trim();
                }
                objcarsInfo.Bodytype = GenFunc.ExcelTextFormat(((Label)row.FindControl("BodyType")).Text).ToString();
                objcarsInfo.ExteriorColor = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblExteriorColor")).Text).ToString();
                objcarsInfo.InteriorColor = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblInteriorColor")).Text).ToString();
                objcarsInfo.VIN = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblVIN")).Text).ToString();
                objcarsInfo.Fueltype = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblFuelType")).Text).ToString();
                objcarsInfo.NumberOfCylinder = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblNumberOfCylinder")).Text).ToString();
                objcarsInfo.Transmission = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblTransmission")).Text).ToString();
                //objcarsInfo.Wheelbase = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblWheelbase")).Text).ToString();
                objcarsInfo.NumberOfDoors = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblDoors")).Text).ToString();
                objcarsInfo.DriveTrain = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblDrivetrain")).Text).ToString();
                //objcarsInfo.VehicleConditionID = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblVehicleCondition")).Text).ToString();
                //objcarsInfo.NumberOfCylinder = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblVehicleCondition")).Text).ToString();

                objUsedCarsInfo.SellerID = 0;

                DataSet dsPackages = objSaveCar.USP_ChkPackageForAddCar(UID);

                int PaymentID;

                //**************************************************???///
                //during we need take user package from dealer package id
                //**************************************************???///
                int UserPackID = 0;

                if (dsPackages.Tables[0].Rows.Count > 0)
                {
                    UserPackID = Convert.ToInt32(dsPackages.Tables[0].Rows[0]["UserPackID"].ToString());
                }
                else
                {
                    dsPackages = objSaveCar.USP_ChkExistingPackage(UID);
                    if (dsPackages.Tables[0].Rows.Count > 0)
                    {
                        UserPackID = Convert.ToInt32(dsPackages.Tables[0].Rows[0]["UserPackID"].ToString());
                        //objUsedCarsInfo.AdStatus = "6";

                    }
                }
                objUsedCarsInfo.AdStatus = "6";

                objcarsInfo.ConditionDescription = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblConditionDescription")).Text).ToString();

                string sDealerCarID = GenFunc.ExcelTextFormat(((HiddenField)row.FindControl("hndDealerUniqueID")).Value).ToString();

                objUsedCarsInfo.SellerID = Convert.ToInt32(0);

                string Source = "";
                string SourcePicID = "";

                string SellerType = "2";
                string SellerID = "0";

                objcarsInfo.DealerUniqueID = GenFunc.ExcelTextFormat(((HiddenField)row.FindControl("hndDealerUniqueID")).Value).ToString();

                objcarsInfo.Uid = Convert.ToInt32(Session[Constants.USER_ID].ToString());

                //UserControl UC = (UserControl)Page.LoadControl("Usercontrol/Header.ascx");

                //System.Web.UI.WebControls.Label lblDealerCode = (System.Web.UI.WebControls.Label)UC.FindControl("lblDealerCode");

                DataSet dsCarsDetails = objSaveCar.SaveCarDetailsForBulkUploadDealers(objcarsInfo, SellerID, SellerType, SourcePicID, Source, sDealerCarID, UserPackID.ToString(), Session[Constants.DealerCode].ToString());

                objcarsInfo.Carid = Convert.ToInt32(dsCarsDetails.Tables[0].Rows[0][0].ToString());

                //string sFilePath = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblPicpath")).Text).ToString();

                //SaveImages(sFilePath, objcarsInfo.YearOfMake.ToString(), objcarsInfo.Make.ToString(), objcarsInfo.Model.ToString(), objcarsInfo.Carid.ToString());

                //if (Session["PaymentID"] == null)
                //{
                //    PackageID = Convert.ToInt32(ddlPackage.SelectedItem.Value);
                //    PaymentID = Convert.ToInt32(0);
                //}
                //else if (Session["PaymentID"].ToString() == "")
                //{
                //    PackageID = Convert.ToInt32(ddlPackage.SelectedItem.Value);
                //    PaymentID = Convert.ToInt32(0);
                //}
                //else
                //{

                //}
                // int PackageID = Convert.ToInt32(Session["PackageID"]); //Convert.ToInt32(ddlPackage.SelectedItem.Value);

            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    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;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //if (Session[Constants.NAME] == null)
        //{
        //    Response.Redirect("../login.aspx");
        //}
        HttpPostedFile uploads = Request.Files["FileData"];
        //HttpContext.Current.Request["RequireUploadifySessionSync"]

        string FileExt = System.IO.Path.GetExtension(uploads.FileName);
        //Get The Ext of File
        //FileName = Server.MapPath(".") + fuAttachments.PostedFile.FileName;

        /*
        if (FileExt != ".jpg" || FileExt != ".png"||FileExt != ".jpeg")
        {

            //return "You have not selected a Excel File.Kindly select Excel File";
        }
         */

        string file = System.IO.Path.GetFileName(uploads.FileName);

        try
        {

            string[] Query1 = Request.QueryString[0].Split('*');

            string Make = Query1[0];
            string Model = Query1[1];
            Model = Model.Replace("/", "@");
            Model = Model.Replace("&", "@");
            string Year = Query1[2];
            string CarID = Query1[3];

            int k = 0;

            if (Session["k"] == null)
            {
                k = 0;
            }
            else
            {
                k = Convert.ToInt32(Session["k"].ToString()) + 1;
            }
            string Filepath = "CarImages//" + Year + "//" + Make + "//" + Model + "//" + CarID + "//";

            string FileNameFullPath = Server.MapPath("../CarImages/" + Year + "/" + Make + "/" + Model + "/" + CarID);

            Session["k"] = k;
            string SelModel = Model.Replace(" ", "-");
            string sNewFileName = Year + "_" + Make + "_" + SelModel + "_" + CarID + k + ".jpg";
            string sNewFileName1 = Year + "_" + Make + "_" + SelModel + "_" + CarID + k + "Thumb.jpg";

            string FileNameSaveData = FileNameFullPath + "//" + sNewFileName;
            string FileNameSaveData1 = FileNameFullPath + "//" + sNewFileName1;

            if (System.IO.Directory.Exists(FileNameFullPath) == false)
            {
                System.IO.Directory.CreateDirectory(FileNameFullPath);
            }

            uploads.SaveAs(FileNameSaveData);

            Bitmap oBitmap = default(Bitmap);
            oBitmap = new Bitmap(FileNameSaveData);
            Graphics oGraphic = default(Graphics);

            int newwidthimg = 600;
            // Here create a new bitmap object of the same height and width of the image.
            float AspectRatio = (float)oBitmap.Size.Width / (float)oBitmap.Size.Height;

            int newHeight = Convert.ToInt32(newwidthimg / AspectRatio);

            Bitmap bmpNew = new Bitmap(newwidthimg, newHeight);
            oGraphic = Graphics.FromImage(bmpNew);

            oGraphic.CompositingQuality = CompositingQuality.HighQuality;
            oGraphic.SmoothingMode = SmoothingMode.HighQuality;
            oGraphic.InterpolationMode = InterpolationMode.HighQualityBicubic;

            oGraphic.DrawImage(oBitmap, new Rectangle(0, 0, bmpNew.Width, bmpNew.Height), 0, 0, oBitmap.Width, oBitmap.Height, GraphicsUnit.Pixel);
            // Release the lock on the image file. Of course,
            // image from the image file is existing in Graphics object
            oBitmap.Dispose();
            oBitmap = bmpNew;

            //SolidBrush oBrush = new SolidBrush(Color.Black);
            //Font ofont = new Font("Arial", 8);
            //oGraphic.DrawString("Some text to write", ofont, oBrush, 10, 10);
            //oGraphic.Dispose();
            //ofont.Dispose();
            //oBrush.Dispose();
            oBitmap.Save(FileNameSaveData, ImageFormat.Jpeg);

            oBitmap.Dispose();

            DealerActions objDealerActions = new DealerActions();

            DataSet dsImgID = objDealerActions.SavePictures(Filepath, sNewFileName, "Jpeg", Convert.ToInt32(Session[Constants.USER_ID].ToString()));

            ArrayList str = new ArrayList();

            //if (Session["Pics"] == null)
            //{
            //    Session["Pics"] = str;
            //}
            //else
            //{
            //    str = (ArrayList)Session["Pics"];
            //}

            //str[k] = dsImgID.Tables[0].Rows[0]["picID"].ToString();
            str.Add(dsImgID.Tables[0].Rows[0]["picID"].ToString());

            DataSet dsImagesData = objDealerActions.USP_GetImages(Convert.ToInt32(CarID), 7);

            //DataSet dsImagesData = Session["GetImages"] as DataSet;
            UsedCarsInfo objcarsInfo = new UsedCarsInfo();

            objcarsInfo.PIC0 = dsImagesData.Tables[0].Rows[0]["pic0"].ToString();
            objcarsInfo.PIC1 = dsImagesData.Tables[0].Rows[0]["pic1"].ToString();
            objcarsInfo.PIC2 = dsImagesData.Tables[0].Rows[0]["pic2"].ToString();
            objcarsInfo.PIC3 = dsImagesData.Tables[0].Rows[0]["pic3"].ToString();
            objcarsInfo.PIC4 = dsImagesData.Tables[0].Rows[0]["pic4"].ToString();
            objcarsInfo.PIC5 = dsImagesData.Tables[0].Rows[0]["pic5"].ToString();
            objcarsInfo.PIC6 = dsImagesData.Tables[0].Rows[0]["pic6"].ToString();
            objcarsInfo.PIC7 = dsImagesData.Tables[0].Rows[0]["pic7"].ToString();
            objcarsInfo.PIC8 = dsImagesData.Tables[0].Rows[0]["pic8"].ToString();
            objcarsInfo.PIC9 = dsImagesData.Tables[0].Rows[0]["pic9"].ToString();
            objcarsInfo.PIC10 = dsImagesData.Tables[0].Rows[0]["pic10"].ToString();
            objcarsInfo.PIC11 = dsImagesData.Tables[0].Rows[0]["pic11"].ToString();
            objcarsInfo.PIC12 = dsImagesData.Tables[0].Rows[0]["pic12"].ToString();
            objcarsInfo.PIC13 = dsImagesData.Tables[0].Rows[0]["pic13"].ToString();
            objcarsInfo.PIC14 = dsImagesData.Tables[0].Rows[0]["pic14"].ToString();
            objcarsInfo.PIC15 = dsImagesData.Tables[0].Rows[0]["pic15"].ToString();
            objcarsInfo.PIC16 = dsImagesData.Tables[0].Rows[0]["pic16"].ToString();
            objcarsInfo.PIC17 = dsImagesData.Tables[0].Rows[0]["pic17"].ToString();
            objcarsInfo.PIC18 = dsImagesData.Tables[0].Rows[0]["pic18"].ToString();
            objcarsInfo.PIC19 = dsImagesData.Tables[0].Rows[0]["pic19"].ToString();
            objcarsInfo.PIC20 = dsImagesData.Tables[0].Rows[0]["pic20"].ToString();

            for (int j = 0; j < str.Count; j++)
            {

                if (str[j].ToString() != "" && str[j].ToString() != "0" && str[j].ToString() != " ")
                {

                    if (objcarsInfo.PIC1 == null || objcarsInfo.PIC1 == "" || objcarsInfo.PIC1 == "0")
                    {
                        objcarsInfo.PIC1 = str[j].ToString();
                        uploads.SaveAs(FileNameSaveData1);

                        Bitmap oBitmap1 = default(Bitmap);
                        oBitmap1 = new Bitmap(FileNameSaveData1);
                        Graphics oGraphic1 = default(Graphics);

                        int newwidthimg1 = 250;
                        // Here create a new bitmap object of the same height and width of the image.
                        float AspectRatio1 = (float)oBitmap1.Size.Width / (float)oBitmap1.Size.Height;

                        int newHeight1 = Convert.ToInt32(newwidthimg1 / AspectRatio);

                        Bitmap bmpNew1 = new Bitmap(newwidthimg1, newHeight1);
                        oGraphic1 = Graphics.FromImage(bmpNew1);

                        oGraphic1.CompositingQuality = CompositingQuality.HighQuality;
                        oGraphic1.SmoothingMode = SmoothingMode.HighQuality;
                        oGraphic1.InterpolationMode = InterpolationMode.HighQualityBicubic;

                        oGraphic1.DrawImage(oBitmap1, new Rectangle(0, 0, bmpNew1.Width, bmpNew1.Height), 0, 0, oBitmap1.Width, oBitmap1.Height, GraphicsUnit.Pixel);
                        // Release the lock on the image file. Of course,
                        // image from the image file is existing in Graphics object
                        oBitmap1.Dispose();
                        oBitmap1 = bmpNew1;

                        //SolidBrush oBrush = new SolidBrush(Color.Black);
                        //Font ofont = new Font("Arial", 8);
                        //oGraphic.DrawString("Some text to write", ofont, oBrush, 10, 10);
                        //oGraphic.Dispose();
                        //ofont.Dispose();
                        //oBrush.Dispose();
                        oBitmap1.Save(FileNameSaveData1, ImageFormat.Jpeg);

                        oBitmap.Dispose();

                        DealerActions objDealerActions1 = new DealerActions();

                        DataSet dsImgID1 = objDealerActions1.SavePictures(Filepath, sNewFileName, "Jpeg", Convert.ToInt32(Session[Constants.USER_ID].ToString()));

                        objcarsInfo.PIC0 = dsImgID1.Tables[0].Rows[0]["picID"].ToString();
                    }
                    else if (objcarsInfo.PIC2 == null || objcarsInfo.PIC2 == "" || objcarsInfo.PIC2 == "0")
                    {
                        objcarsInfo.PIC2 = str[j].ToString();
                    }
                    else if (objcarsInfo.PIC3 == null || objcarsInfo.PIC3 == "" || objcarsInfo.PIC3 == "0")
                    {
                        objcarsInfo.PIC3 = str[j].ToString();
                    }
                    else if (objcarsInfo.PIC4 == null || objcarsInfo.PIC4 == "" || objcarsInfo.PIC4 == "0")
                    {
                        objcarsInfo.PIC4 = str[j].ToString();
                    }
                    else if (objcarsInfo.PIC5 == null || objcarsInfo.PIC5 == "" || objcarsInfo.PIC5 == "0")
                    {
                        objcarsInfo.PIC5 = str[j].ToString();
                    }
                    else if (objcarsInfo.PIC6 == null || objcarsInfo.PIC6 == "" || objcarsInfo.PIC6 == "0")
                    {
                        objcarsInfo.PIC6 = str[j].ToString();
                    }

                    else if (objcarsInfo.PIC7 == null || objcarsInfo.PIC7 == "" || objcarsInfo.PIC7 == "0")
                    {
                        objcarsInfo.PIC7 = str[j].ToString();
                    }
                    else if (objcarsInfo.PIC8 == null || objcarsInfo.PIC8 == "" || objcarsInfo.PIC8 == "0")
                    {
                        objcarsInfo.PIC8 = str[j].ToString();
                    }
                    else if (objcarsInfo.PIC9 == null || objcarsInfo.PIC9 == "" || objcarsInfo.PIC9 == "0")
                    {
                        objcarsInfo.PIC9 = str[j].ToString();
                    }
                    else if (objcarsInfo.PIC10 == null || objcarsInfo.PIC10 == "" || objcarsInfo.PIC10 == "0")
                    {
                        objcarsInfo.PIC10 = str[j].ToString();
                    }
                    else if (objcarsInfo.PIC11 == null || objcarsInfo.PIC11 == "" || objcarsInfo.PIC11 == "0")
                    {
                        objcarsInfo.PIC11 = str[j].ToString();
                    }

                    else if (objcarsInfo.PIC12 == null || objcarsInfo.PIC12 == "" || objcarsInfo.PIC12 == "0")
                    {
                        objcarsInfo.PIC12 = str[j].ToString();
                    }
                    else if (objcarsInfo.PIC13 == null || objcarsInfo.PIC13 == "" || objcarsInfo.PIC13 == "0")
                    {
                        objcarsInfo.PIC13 = str[j].ToString();
                    }
                    else if (objcarsInfo.PIC14 == null || objcarsInfo.PIC14 == "" || objcarsInfo.PIC14 == "0")
                    {
                        objcarsInfo.PIC14 = str[j].ToString();
                    }
                    else if (objcarsInfo.PIC15 == null || objcarsInfo.PIC15 == "" || objcarsInfo.PIC15 == "0")
                    {
                        objcarsInfo.PIC15 = str[j].ToString();
                    }

                    else if (objcarsInfo.PIC16 == null || objcarsInfo.PIC16 == "" || objcarsInfo.PIC16 == "0")
                    {
                        objcarsInfo.PIC16 = str[j].ToString();
                    }
                    else if (objcarsInfo.PIC17 == null || objcarsInfo.PIC17 == "" || objcarsInfo.PIC17 == "0")
                    {
                        objcarsInfo.PIC17 = str[j].ToString();
                    }
                    else if (objcarsInfo.PIC18 == null || objcarsInfo.PIC18 == "" || objcarsInfo.PIC18 == "0")
                    {
                        objcarsInfo.PIC18 = str[j].ToString();
                    }
                    else if (objcarsInfo.PIC19 == null || objcarsInfo.PIC19 == "" || objcarsInfo.PIC19 == "0")
                    {
                        objcarsInfo.PIC19 = str[j].ToString();
                    }
                    else if (objcarsInfo.PIC20 == null || objcarsInfo.PIC20 == "" || objcarsInfo.PIC20 == "0")
                    {
                        objcarsInfo.PIC20 = str[j].ToString();
                    }
                }
                objcarsInfo.Carid = Convert.ToInt32(CarID);
            }

            bool bnew = objDealerActions.UpdatePicturesById(objcarsInfo, Convert.ToInt32(Session[Constants.USER_ID].ToString()));

        }
        catch(Exception ex)
        {

        }
    }
Example #25
0
        public IList<UsedCarsInfo> GetCarBannerAds()
        {
            IList<UsedCarsInfo> UsedCarsIList = new List<UsedCarsInfo>();

            string spNameString = string.Empty;

            //objUsedCars.Setting Connection
            //objUsedCars.Global.INSTANCE_NAME = strCurrentConn;

            IDataReader UsedCarsDataReader = null;

            //objUsedCars.Connect to the database
            Database dbDatabase = DatabaseFactory.CreateDatabase(Global.INSTANCE_NAME);

            //objUsedCars.Assign stored procedure name

            spNameString = "[GetCarBannerAds]";
            DbCommand dbCommand = null;

            try
            {
                //objUsedCars.Set stored procedure to the command object
                dbCommand = dbDatabase.GetStoredProcCommand(spNameString);

                dbCommand.CommandTimeout = 10000;

                //objUsedCars.Executing stored procedure
                UsedCarsDataReader = dbDatabase.ExecuteReader(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;
        }
        //--------------------------MinandMaxValues---------31-07-2013------------//
        private void AssignCarsInfoListMinandMax(IDataReader UsedCarsDataReader, UsedCarsInfo objUsedCars)
        {
            try
            {

                objUsedCars.Email = UsedCarsDataReader["MinP"].ToString() == "" ? "Emp" : UsedCarsDataReader["MinP"].ToString();
                objUsedCars.Address1 = UsedCarsDataReader["MaxP"].ToString() == "" ? "Emp" : UsedCarsDataReader["MaxP"].ToString();
                objUsedCars.Address2 = UsedCarsDataReader["MinY"].ToString() == "" ? "Emp" : UsedCarsDataReader["MinY"].ToString();
                objUsedCars.City = UsedCarsDataReader["MaxY"].ToString() == "" ? "Emp" : UsedCarsDataReader["MaxY"].ToString();
                objUsedCars.State = UsedCarsDataReader["MinM"].ToString();
                objUsedCars.Description = UsedCarsDataReader["MaxM"].ToString() == "" ? "Emp" : UsedCarsDataReader["MaxM"].ToString();

            }
            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, Global.EXCEPTION_POLICY);

            }
        }
Example #27
0
        public IList<UsedCarsInfo> SimialarCars(string MakeId, string ModelID, string zipcode, string Price)
        {
            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 = "[USP_SimilarCars]";
            DbCommand dbCommand = null;

            IDataReader UsedCarsDataReader = null;

            try
            {
                //Set stored procedure to the command object
                dbCommand = dbDatabase.GetStoredProcCommand(spNameString);

                dbCommand.CommandTimeout = 10000;

                dbDatabase.AddInParameter(dbCommand, "@MakeID", DbType.String, MakeId);
                dbDatabase.AddInParameter(dbCommand, "@Zipcode", DbType.String, zipcode);
                dbDatabase.AddInParameter(dbCommand, "@Price", DbType.String, Price);
                dbDatabase.AddInParameter(dbCommand, "@ModelID", DbType.String, ModelID);

                //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;
        }
        //-----------------------Ends---------------------//
        //------------------------------MinandMaxValues 31-07-2013-----------//
        //-----------------------Starts 25-07-2013--------------------//
        public IList<UsedCarsInfo> MinandMaxValues(string carMakeid, string CarModalId, string ZipCode, string WithinZip)
        {
            IList<UsedCarsInfo> UsedCarsIList = new List<UsedCarsInfo>();

            string spNameString = string.Empty;
            IDataReader UsedCarsDataReader = null;
            Database dbDatabase = DatabaseFactory.CreateDatabase(Global.INSTANCE_NAME);

            //objUsedCars.Assign stored procedure name
            // spNameString = "[USP_SearchCarsNew]";
            spNameString = "[USP_MinandMaxValues]";
            DbCommand dbCommand = null;

            try
            {
                //objUsedCars.Set stored procedure to the command object
                dbCommand = dbDatabase.GetStoredProcCommand(spNameString);

                dbDatabase.AddInParameter(dbCommand, "@makeID", DbType.String, carMakeid);
                dbDatabase.AddInParameter(dbCommand, "@makeModelID", DbType.String, CarModalId);
                dbDatabase.AddInParameter(dbCommand, "@Nearby", DbType.Int64, WithinZip);
                dbDatabase.AddInParameter(dbCommand, "@Pin", DbType.Int64, ZipCode);

                UsedCarsDataReader = dbDatabase.ExecuteReader(dbCommand);

                while (UsedCarsDataReader.Read())
                {
                    //  objUsedCars.Assign values to the CarsInfo object list
                    UsedCarsInfo ObjCarsInfo_Info = new UsedCarsInfo();
                    AssignCarsInfoListMinandMax(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;
        }
Example #29
0
        private void AssignCarsInfoListSpeed(IDataReader UsedCarsDataReader, UsedCarsInfo objUsedCars)
        {
            try
            {
                objUsedCars.PostingID = Convert.ToInt32(UsedCarsDataReader["PostingID"].ToString());
                objUsedCars.Carid = Convert.ToInt32(UsedCarsDataReader["Carid"].ToString());
                objUsedCars.SellerType = UsedCarsDataReader["SellerType"].ToString();
                objUsedCars.SellerID = Convert.ToInt32(UsedCarsDataReader["SellerID"].ToString());

                objUsedCars.PackageID = UsedCarsDataReader["PackageID"].ToString() == "" ? 0 : Convert.ToInt32(UsedCarsDataReader["PackageID"].ToString());

                objUsedCars.IsActive = UsedCarsDataReader["IsActive"].ToString() == "" ? true : Convert.ToBoolean(UsedCarsDataReader["IsActive"].ToString());

                objUsedCars.Uid = UsedCarsDataReader["Uid"].ToString() == "" ? 0 : Convert.ToInt32(UsedCarsDataReader["Uid"].ToString());

                objUsedCars.Address1 = UsedCarsDataReader["Address1"].ToString() == "" ? "Emp" : UsedCarsDataReader["Address1"].ToString();
                objUsedCars.Address2 = UsedCarsDataReader["Address2"].ToString() == "" ? "Emp" : UsedCarsDataReader["Address2"].ToString();
                objUsedCars.City = UsedCarsDataReader["City"].ToString() == "" ? "Emp" : UsedCarsDataReader["City"].ToString();
                objUsedCars.State = UsedCarsDataReader["State"].ToString();
                objUsedCars.Zip = UsedCarsDataReader["Zip"].ToString() == "" ? "Emp" : UsedCarsDataReader["Zip"].ToString();

                objUsedCars.Phone = UsedCarsDataReader["Phone"].ToString();

                objUsedCars.Email = UsedCarsDataReader["Email"].ToString() == "" ? "Emp" : UsedCarsDataReader["Email"].ToString();

                objUsedCars.Model = UsedCarsDataReader["model"].ToString();
                objUsedCars.Make = UsedCarsDataReader["make"].ToString();
                objUsedCars.YearOfMake = UsedCarsDataReader["yearOfMake"].ToString() == "" ? 0 : Convert.ToInt32(UsedCarsDataReader["yearOfMake"].ToString());
                objUsedCars.Mileage = UsedCarsDataReader["mileage"].ToString() == "" ? "0" : UsedCarsDataReader["mileage"].ToString();

                objUsedCars.Price = UsedCarsDataReader["price"].ToString() == "" ? 0.00 : Convert.ToDouble(UsedCarsDataReader["price"].ToString());
                objUsedCars.Description = UsedCarsDataReader["description"].ToString() == "" ? "Emp" : UsedCarsDataReader["description"].ToString();

                objUsedCars.Bodytype = UsedCarsDataReader["bodytype"].ToString();
                objUsedCars.BodytypeID = Convert.ToInt32(UsedCarsDataReader["BodytypeID"].ToString());
                objUsedCars.FueltypeId = Convert.ToInt32(UsedCarsDataReader["FueltypeID"].ToString());
                objUsedCars.Fueltype = UsedCarsDataReader["Fueltype"].ToString();

                objUsedCars.Title = UsedCarsDataReader["Title"].ToString() == "" ? "Emp" : UsedCarsDataReader["Title"].ToString();

                objUsedCars.CarUniqueID = UsedCarsDataReader["CarUniqueID"].ToString() == "" ? "Emp" : UsedCarsDataReader["CarUniqueID"].ToString();

                objUsedCars.AdStatus = UsedCarsDataReader["AdStatusName"].ToString() == "" ? "Emp" : UsedCarsDataReader["AdStatusName"].ToString();

                objUsedCars.ExteriorColor = UsedCarsDataReader["exteriorColor"].ToString() == "" ? "Emp" : UsedCarsDataReader["exteriorColor"].ToString();
                objUsedCars.NumberOfSeats = UsedCarsDataReader["numberOfSeats"].ToString() == "" ? "Emp" : UsedCarsDataReader["numberOfSeats"].ToString();
                objUsedCars.NumberOfDoors = UsedCarsDataReader["numberOfDoors"].ToString() == "" ? "Emp" : UsedCarsDataReader["numberOfDoors"].ToString();
                objUsedCars.NumberOfCylinder = UsedCarsDataReader["numberOfCylinder"].ToString() == "" ? "Emp" : UsedCarsDataReader["numberOfCylinder"].ToString();
                objUsedCars.Transmission = UsedCarsDataReader["Transmission"].ToString() == "" ? "Emp" : UsedCarsDataReader["Transmission"].ToString();
                objUsedCars.InteriorColor = UsedCarsDataReader["interiorColor"].ToString() == "" ? "Emp" : UsedCarsDataReader["interiorColor"].ToString();
                objUsedCars.SellerName = UsedCarsDataReader["SellerName"].ToString() == "" ? "Emp" : UsedCarsDataReader["SellerName"].ToString();

                try
                {
                    objUsedCars.PaymentID = UsedCarsDataReader["pmntStatus"].ToString() == "" ? 0 : Convert.ToInt32(UsedCarsDataReader["pmntStatus"].ToString());
                }
                catch { }

                objUsedCars.PIC0 = UsedCarsDataReader["PIC0"].ToString() == "" ? GetStockURL(objUsedCars.Make, objUsedCars.Model) : UsedCarsDataReader["PIC0"].ToString();
                objUsedCars.PICLOC0 = UsedCarsDataReader["PICLOC0"].ToString() == "" ? "Emp" : UsedCarsDataReader["PICLOC0"].ToString();
                try
                {
                    objUsedCars.DateOfPosting = Convert.ToDateTime(UsedCarsDataReader["DateOfPosting"].ToString());
                    objUsedCars.ExpirtyDate = UsedCarsDataReader["ExpirtyDate"].ToString() == "" ? System.DateTime.Now : Convert.ToDateTime(UsedCarsDataReader["ExpirtyDate"].ToString());
                   // objUsedCars.PaymentID = UsedCarsDataReader["PaymentID"].ToString() == "" ? 0 : Convert.ToInt32(UsedCarsDataReader["PaymentID"].ToString());
                    objUsedCars.InternalreviewID = UsedCarsDataReader["InternalreviewID"].ToString() == "" ? 0 : Convert.ToInt32(UsedCarsDataReader["InternalreviewID"].ToString());
                    objUsedCars.CancelledBy = UsedCarsDataReader["CancelledBy"].ToString() == "" ? 0 : Convert.ToInt32(UsedCarsDataReader["CancelledBy"].ToString());
                    objUsedCars.CancelledReason = UsedCarsDataReader["CancelledReason"].ToString();
                    objUsedCars.CancelledDate = UsedCarsDataReader["CancelledDate"].ToString() == "" ? System.DateTime.Now : Convert.ToDateTime(UsedCarsDataReader["CancelledDate"].ToString());
                    objUsedCars.Zipcode = UsedCarsDataReader["Zipcode"].ToString() == "" ? "Emp" : UsedCarsDataReader["Zipcode"].ToString();

                    objUsedCars.Country = UsedCarsDataReader["Country"].ToString() == "1" ? "USA" : UsedCarsDataReader["Country"].ToString();
                    objUsedCars.AltPhone = UsedCarsDataReader["AltPhone"].ToString();
                    objUsedCars.Fax = UsedCarsDataReader["Fax"].ToString();
                    objUsedCars.AltEmail = UsedCarsDataReader["AltEmail"].ToString() == "" ? "Emp" : UsedCarsDataReader["Email"].ToString();
                    objUsedCars.NotesForBuyers = UsedCarsDataReader["NotesForBuyers"].ToString();
                    objUsedCars.MakeID = UsedCarsDataReader["makeID"].ToString() == "" ? 0 : Convert.ToInt32(UsedCarsDataReader["makeID"].ToString());
                    objUsedCars.MakeModelID = UsedCarsDataReader["makeModelID"].ToString() == "" ? 0 : Convert.ToInt32(UsedCarsDataReader["makeModelID"].ToString());
                    objUsedCars.VIN = UsedCarsDataReader["VIN"].ToString() == "" ? "Emp" : UsedCarsDataReader["VIN"].ToString();

                    objUsedCars.ConditionDescription = UsedCarsDataReader["ConditionDescription"].ToString() == "" ? "Emp" : UsedCarsDataReader["ConditionDescription"].ToString();

                    objUsedCars.DriveTrain = UsedCarsDataReader["DriveTrain"].ToString() == "" ? "Emp" : UsedCarsDataReader["DriveTrain"].ToString();

                    objUsedCars.PIC1 = UsedCarsDataReader["PIC1"].ToString() == "" ? "Emp" : UsedCarsDataReader["PIC1"].ToString();
                    objUsedCars.PIC2 = UsedCarsDataReader["PIC2"].ToString() == "" ? "Emp" : UsedCarsDataReader["PIC2"].ToString();
                    objUsedCars.PIC3 = UsedCarsDataReader["PIC3"].ToString() == "" ? "Emp" : UsedCarsDataReader["PIC3"].ToString();
                    objUsedCars.PIC4 = UsedCarsDataReader["PIC4"].ToString() == "" ? "Emp" : UsedCarsDataReader["PIC4"].ToString();
                    objUsedCars.PIC5 = UsedCarsDataReader["PIC5"].ToString() == "" ? "Emp" : UsedCarsDataReader["PIC5"].ToString();
                    objUsedCars.PIC6 = UsedCarsDataReader["PIC6"].ToString() == "" ? "Emp" : UsedCarsDataReader["PIC6"].ToString();
                    objUsedCars.PIC7 = UsedCarsDataReader["PIC7"].ToString() == "" ? "Emp" : UsedCarsDataReader["PIC7"].ToString();
                    objUsedCars.PIC8 = UsedCarsDataReader["PIC8"].ToString() == "" ? "Emp" : UsedCarsDataReader["PIC8"].ToString();
                    objUsedCars.PIC9 = UsedCarsDataReader["PIC9"].ToString() == "" ? "Emp" : UsedCarsDataReader["PIC9"].ToString();
                    objUsedCars.PIC10 = UsedCarsDataReader["PIC10"].ToString() == "" ? "Emp" : UsedCarsDataReader["PIC10"].ToString();
                    objUsedCars.PICLOC0 = UsedCarsDataReader["PICLOC0"].ToString() == "" ? "Emp" : UsedCarsDataReader["PICLOC0"].ToString();
                    objUsedCars.PICLOC1 = UsedCarsDataReader["PICLOC1"].ToString() == "" ? "Emp" : UsedCarsDataReader["PICLOC1"].ToString();
                    objUsedCars.PICLOC2 = UsedCarsDataReader["PICLOC2"].ToString() == "" ? "Emp" : UsedCarsDataReader["PICLOC2"].ToString();
                    objUsedCars.PICLOC3 = UsedCarsDataReader["PICLOC3"].ToString() == "" ? "Emp" : UsedCarsDataReader["PICLOC3"].ToString();
                    objUsedCars.PICLOC4 = UsedCarsDataReader["PICLOC4"].ToString() == "" ? "Emp" : UsedCarsDataReader["PICLOC4"].ToString();
                    objUsedCars.PICLOC5 = UsedCarsDataReader["PICLOC5"].ToString() == "" ? "Emp" : UsedCarsDataReader["PICLOC5"].ToString();
                    objUsedCars.PICLOC6 = UsedCarsDataReader["PICLOC6"].ToString() == "" ? "Emp" : UsedCarsDataReader["PICLOC6"].ToString();
                    objUsedCars.PICLOC7 = UsedCarsDataReader["PICLOC7"].ToString() == "" ? "Emp" : UsedCarsDataReader["PICLOC7"].ToString();
                    objUsedCars.PICLOC8 = UsedCarsDataReader["PICLOC8"].ToString() == "" ? "Emp" : UsedCarsDataReader["PICLOC8"].ToString();
                    objUsedCars.PICLOC9 = UsedCarsDataReader["PICLOC9"].ToString() == "" ? "Emp" : UsedCarsDataReader["PICLOC9"].ToString();
                    objUsedCars.PICLOC10 = UsedCarsDataReader["PICLOC10"].ToString() == "" ? "Emp" : UsedCarsDataReader["PICLOC10"].ToString();

                    objUsedCars.PIC11 = UsedCarsDataReader["PIC11"].ToString() == "" ? "Emp" : UsedCarsDataReader["PIC11"].ToString();
                    objUsedCars.PIC12 = UsedCarsDataReader["PIC12"].ToString() == "" ? "Emp" : UsedCarsDataReader["PIC12"].ToString();
                    objUsedCars.PIC13 = UsedCarsDataReader["PIC13"].ToString() == "" ? "Emp" : UsedCarsDataReader["PIC13"].ToString();
                    objUsedCars.PIC14 = UsedCarsDataReader["PIC14"].ToString() == "" ? "Emp" : UsedCarsDataReader["PIC14"].ToString();
                    objUsedCars.PIC15 = UsedCarsDataReader["PIC15"].ToString() == "" ? "Emp" : UsedCarsDataReader["PIC15"].ToString();
                    objUsedCars.PIC16 = UsedCarsDataReader["PIC16"].ToString() == "" ? "Emp" : UsedCarsDataReader["PIC16"].ToString();
                    objUsedCars.PIC17 = UsedCarsDataReader["PIC17"].ToString() == "" ? "Emp" : UsedCarsDataReader["PIC17"].ToString();
                    objUsedCars.PIC18 = UsedCarsDataReader["PIC18"].ToString() == "" ? "Emp" : UsedCarsDataReader["PIC18"].ToString();
                    objUsedCars.PIC19 = UsedCarsDataReader["PIC19"].ToString() == "" ? "Emp" : UsedCarsDataReader["PIC19"].ToString();
                    objUsedCars.PIC20 = UsedCarsDataReader["PIC20"].ToString() == "" ? "Emp" : UsedCarsDataReader["PIC20"].ToString();

                    objUsedCars.PICLOC11 = UsedCarsDataReader["PICLOC11"].ToString() == "" ? "Emp" : UsedCarsDataReader["PICLOC11"].ToString();
                    objUsedCars.PICLOC12 = UsedCarsDataReader["PICLOC12"].ToString() == "" ? "Emp" : UsedCarsDataReader["PICLOC12"].ToString();
                    objUsedCars.PICLOC13 = UsedCarsDataReader["PICLOC13"].ToString() == "" ? "Emp" : UsedCarsDataReader["PICLOC13"].ToString();
                    objUsedCars.PICLOC14 = UsedCarsDataReader["PICLOC14"].ToString() == "" ? "Emp" : UsedCarsDataReader["PICLOC14"].ToString();
                    objUsedCars.PICLOC15 = UsedCarsDataReader["PICLOC15"].ToString() == "" ? "Emp" : UsedCarsDataReader["PICLOC15"].ToString();
                    objUsedCars.PICLOC16 = UsedCarsDataReader["PICLOC16"].ToString() == "" ? "Emp" : UsedCarsDataReader["PICLOC16"].ToString();
                    objUsedCars.PICLOC17 = UsedCarsDataReader["PICLOC17"].ToString() == "" ? "Emp" : UsedCarsDataReader["PICLOC17"].ToString();
                    objUsedCars.PICLOC18 = UsedCarsDataReader["PICLOC18"].ToString() == "" ? "Emp" : UsedCarsDataReader["PICLOC18"].ToString();
                    objUsedCars.PICLOC19 = UsedCarsDataReader["PICLOC19"].ToString() == "" ? "Emp" : UsedCarsDataReader["PICLOC19"].ToString();
                    objUsedCars.PICLOC20 = UsedCarsDataReader["PICLOC20"].ToString() == "" ? "Emp" : UsedCarsDataReader["PICLOC20"].ToString();

                }
                catch { }

                try
                {
                    objUsedCars.RowNumber = UsedCarsDataReader["RowNumber"].ToString() == "" ? "Emp" : UsedCarsDataReader["RowNumber"].ToString();
                }
                catch { }
                try
                {
                    objUsedCars.TotalRecords = UsedCarsDataReader["TotalRecords"].ToString() == "" ? "Emp" : UsedCarsDataReader["TotalRecords"].ToString();
                }
                catch { }
                try
                {
                    objUsedCars.PageCount = UsedCarsDataReader["PageCount"].ToString() == "" ? "Emp" : UsedCarsDataReader["PageCount"].ToString();
                }
                catch { }

                try
                {
                    objUsedCars.UserFeedback = UsedCarsDataReader["UserFeedback"].ToString();
                }
                catch { }

                // objUsedCars.TotalRecords = UsedCarsDataReader["DiffYear"].ToString() == "" ? "Emp" : UsedCarsDataReader["DiffYear"].ToString();

                //objUsedCars.pic0 = UsedCarsDataReader["pic0"].ToString();

            }
            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, Global.EXCEPTION_POLICY);

            }
        }
Example #30
0
        public DataSet USP_SaveSellerInfo(UsedCarsInfo objUsedCarsInfo, int CarID, int UID)
        {
            try
            {
                bool bnew = false;
                DataSet dsCars = new DataSet();
                string spNameString = string.Empty;
                Database dbDatabase = DatabaseFactory.CreateDatabase(Global.CarsConnTest);
                spNameString = "USP_UpdateMobileSellerInfo";
                DbCommand dbCommand = null;
                dbCommand = dbDatabase.GetStoredProcCommand(spNameString);

                dbDatabase.AddInParameter(dbCommand, "@sellerID", System.Data.DbType.Int32, objUsedCarsInfo.SellerID);
                dbDatabase.AddInParameter(dbCommand, "@sellerName", System.Data.DbType.String, objUsedCarsInfo.SellerName);
                //dbDatabase.AddInParameter(dbCommand, "@address1", System.Data.DbType.String, objUsedCarsInfo.Address1);
                dbDatabase.AddInParameter(dbCommand, "@city", System.Data.DbType.String, objUsedCarsInfo.City);
                dbDatabase.AddInParameter(dbCommand, "@state", System.Data.DbType.String, objUsedCarsInfo.State);
                dbDatabase.AddInParameter(dbCommand, "@Zip", System.Data.DbType.String, objUsedCarsInfo.Zip);
                dbDatabase.AddInParameter(dbCommand, "@Phone", System.Data.DbType.String, objUsedCarsInfo.Phone);
                dbDatabase.AddInParameter(dbCommand, "@email", System.Data.DbType.String, objUsedCarsInfo.Email);
                dbDatabase.AddInParameter(dbCommand, "@CarID", System.Data.DbType.Int32, CarID);
                dbDatabase.AddInParameter(dbCommand, "@UID", System.Data.DbType.Int32, UID);

                dsCars = dbDatabase.ExecuteDataSet(dbCommand);
                return dsCars;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }