Ejemplo n.º 1
0
    public List<CarsInfo.MobileCarInfo> AddCarDetails(string make, string model, string price, string year, string mileage, string UID, string userPackID, string packageID, string AuthenticationID, string CustomerID, string SessionID)
    {
        List<CarsInfo.MobileCarInfo> obj = new List<CarsInfo.MobileCarInfo>();
        MobileBL objMobileBL = new MobileBL();
        MobileCarInfo objCarInfo = new MobileCarInfo();
        if (CustomerID.Trim() != "")
        {
            string parameter = make + "," + model + "," + price + "," + year;
            DataSet dsSaveCustInfo = objMobileBL.SaveMobileCustomerInfo("AddCarDetails", CustomerID, AuthenticationID, parameter);
        }
        try
        {
            bool bnew = objMobileBL.CheckMobileAuthorizeUSer(SessionID, Convert.ToInt32(UID));
            if (bnew)
            {
                DataSet dsPackages = objMobileBL.MobileChkPackageForAddCar(Convert.ToInt32(UID));

                if (dsPackages.Tables.Count > 0)
                {
                    if (dsPackages.Tables[0].Rows.Count > 0)
                    {
                        if (make != "" && model != "" && year != "" && price != "" && mileage != "")
                        {
                            DataSet dsCar = objMobileBL.SaveMobileNewCarDetails(make, model, year, mileage, price, Convert.ToInt32(userPackID), Convert.ToInt32(packageID), Convert.ToInt32(UID));
                            if (dsCar.Tables.Count > 0)
                            {
                                if (dsCar.Tables[0].Rows.Count > 0)
                                {
                                    objCarInfo.AASuccess = "Success";
                                    objCarInfo.CarID = dsCar.Tables[0].Rows[0]["CarID"].ToString();
                                }
                                else
                                {
                                    objCarInfo.AASuccess = "Failure";
                                    objCarInfo.Reason = "Car details are not added";
                                }
                            }
                            else
                            {
                                objCarInfo.AASuccess = "Failure";
                                objCarInfo.Reason = "Car details are not added";
                            }

                        }
                        else if (make == "")
                        {
                            objCarInfo.AASuccess = "Failure";
                            objCarInfo.Reason = "Make should not be empty";

                        }
                        else if (model == "")
                        {
                            objCarInfo.AASuccess = "Failure";
                            objCarInfo.Reason = "Model should not be empty";

                        }
                        else if (price == "")
                        {
                            objCarInfo.AASuccess = "Failure";
                            objCarInfo.Reason = "Price should not be empty";

                        }

                        else if (mileage == "")
                        {
                            objCarInfo.AASuccess = "Failure";
                            objCarInfo.Reason = "Mileage should not be empty";

                        }

                        else if (userPackID == "" || packageID == "")
                        {
                            objCarInfo.AASuccess = "Failure";
                            objCarInfo.Reason = "Package should not be empty";
                        }
                    }
                    else
                    {
                        objCarInfo.AASuccess = "Failure";
                        objCarInfo.Reason = "Maxcars count exceeded";
                    }
                }
                else
                {
                    objCarInfo.AASuccess = "Failure";
                    objCarInfo.Reason = "Maxcars count exceeded";
                }

            }
            else
            {
                objCarInfo.AASuccess = "Session timed out";
            }

            obj.Add(objCarInfo);
        }
        catch (Exception ex)
        {
        }
        return obj;
    }