示例#1
0
    public string UpdateCarDetails(string UID, string Year, string ExteriorColor, string InteriorColor, string Transmission, string DriveTrain, string NumberOfDoors, string MakeModelID,
                                    string BodyTypeID, string CarID, string Price, string Mileage, string VIN, string NumberOfCylinder, string FueltypeID, string zip,
                                    string City, string Description, string VehicleCondition, string Title, string StateID, string AuthenticationID, string CustomerID, string SessionID)
    {
        string returnCarID = "Failed";
        DropdownBL objdropdownBL = new DropdownBL();
        CarsInfo.CarsInfo objcarsInfo = new CarsInfo.CarsInfo();

        MobileBL objMobileBL = new MobileBL();
        if (CustomerID.Trim() != "")
        {
            DataSet dsSaveCustInfo = objMobileBL.SaveMobileCustomerInfo("UpdateCarDetails", CustomerID, AuthenticationID,CarID);
        }
        bool bnew = objMobileBL.CheckMobileAuthorizeUSer(SessionID, Convert.ToInt32(UID));
        if (bnew)
        {
            try
            {
                if (AuthenticationID == ConfigurationManager.AppSettings["AppleID"].ToString())
                {
                    int Uid = Convert.ToInt32(UID);
                    objcarsInfo.YearOfMake = Convert.ToInt32(Year);
                    objcarsInfo.MakeModelID = Convert.ToInt32(MakeModelID);
                    objcarsInfo.BodyTypeID = Convert.ToInt32(BodyTypeID);
                    objcarsInfo.CarID = Convert.ToInt32(CarID);
                    //Check for same make,model year of car
                    DataSet dsCarID = objMobileBL.CheckMobileCarDetailsByCarID(Convert.ToInt32(CarID), objcarsInfo.MakeModelID, objcarsInfo.YearOfMake);
                    if (dsCarID.Tables.Count > 0)
                    {
                        if (dsCarID.Tables[0].Rows.Count > 0)
                        {
                            if (Price == "")
                            {
                                objcarsInfo.Price = "0";
                            }
                            else
                            {
                                objcarsInfo.Price = Price;
                            }
                            if (Mileage == "")
                            {
                                objcarsInfo.Mileage = "0";
                            }
                            else
                            {
                                objcarsInfo.Mileage = Mileage;
                            }
                            objcarsInfo.ExteriorColor = ExteriorColor;
                            objcarsInfo.InteriorColor = InteriorColor;
                            objcarsInfo.Transmission = Transmission;
                            objcarsInfo.DriveTrain = DriveTrain;
                            objcarsInfo.NumberOfDoors = NumberOfDoors;
                            objcarsInfo.VIN = VIN;
                            objcarsInfo.NumberOfCylinder = NumberOfCylinder;
                            objcarsInfo.FuelTypeID = Convert.ToInt32(FueltypeID);
                            if (zip.Length == 4)
                            {
                                objcarsInfo.Zipcode = "0" + zip;
                            }
                            else
                            {
                                objcarsInfo.Zipcode = zip;
                            }
                            objcarsInfo.City = GeneralFunc.ToProper(City);
                            objcarsInfo.StateID = Convert.ToInt32(StateID);
                            string Condition = GeneralFunc.ToProper(Description);
                            DataSet dsCarsDetails = objdropdownBL.USP_SaveCarDetails(objcarsInfo, Condition, VehicleCondition, Title, Uid);
                            if (dsCarsDetails.Tables.Count > 0)
                            {
                                if (dsCarsDetails.Tables[0].Rows.Count > 0)
                                {
                                    returnCarID = "Success";
                                }
                                else
                                 {
                                    returnCarID = "Failed";
                                }
                            }
                            else
                            {
                                returnCarID = "Failed";
                            }
                        }
                        else
                        {
                            returnCarID = "Sorry we are not able to change year,make and model of your car";
                        }
                    }
                    else
                    {
                        returnCarID = "Sorry we are not able to change year,make and model of your car";
                    }
                }

            }

            catch (Exception ex)
            {
            }
        }
        else
        {
            returnCarID = "Session timed out";
        }
        return returnCarID;
    }