Ejemplo n.º 1
0
        public DataSet SaveCarDetailsToUCE(DealerSiteCarInfo objCarInfo, string UID)
        {
            DataSet ds = new DataSet();
            string spNameString = string.Empty;

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

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

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

                dbDatabase.AddInParameter(dbCommand, "@CarID", DbType.Int64, objCarInfo.CarID);
                dbDatabase.AddInParameter(dbCommand, "@YearOfMake", DbType.Int32, objCarInfo.MakeModelYear);
                dbDatabase.AddInParameter(dbCommand, "@Make", DbType.String, objCarInfo.Make);
                dbDatabase.AddInParameter(dbCommand, "@Model", DbType.String, objCarInfo.Model);
                dbDatabase.AddInParameter(dbCommand, "@BodyType", DbType.String, objCarInfo.BodyType);
                dbDatabase.AddInParameter(dbCommand, "@VehicleCondition", DbType.String, objCarInfo.VehicleCondition);
                dbDatabase.AddInParameter(dbCommand, "@DriveTrain", DbType.String, objCarInfo.DriveTrain);
                dbDatabase.AddInParameter(dbCommand, "@Price", DbType.String, objCarInfo.SellingPrice);
                dbDatabase.AddInParameter(dbCommand, "@Mileage", DbType.Int32, objCarInfo.Mileage);
                dbDatabase.AddInParameter(dbCommand, "@ExteriorColor", DbType.String, objCarInfo.ExtColor);
                dbDatabase.AddInParameter(dbCommand, "@InteriorColor", DbType.String, objCarInfo.IntColor);
                dbDatabase.AddInParameter(dbCommand, "@Transmission", DbType.String, objCarInfo.Transmission);
                dbDatabase.AddInParameter(dbCommand, "@NumberOfDoors", DbType.String, objCarInfo.Doors);
                dbDatabase.AddInParameter(dbCommand, "@VIN", DbType.String, objCarInfo.VIN);
                dbDatabase.AddInParameter(dbCommand, "@NumberOfCylinder", DbType.String, objCarInfo.Cylinders);
                dbDatabase.AddInParameter(dbCommand, "@FuelType", DbType.String, objCarInfo.FuelType);
                dbDatabase.AddInParameter(dbCommand, "@Description", DbType.String, objCarInfo.Description);
                dbDatabase.AddInParameter(dbCommand, "@Title", DbType.String, objCarInfo.Title);
                dbDatabase.AddInParameter(dbCommand, "@CarStatus", DbType.String, objCarInfo.CarStatus);
                dbDatabase.AddInParameter(dbCommand, "@SellerName", DbType.String, objCarInfo.SellerName);
                dbDatabase.AddInParameter(dbCommand, "@City", DbType.String, objCarInfo.SellerCity);
                dbDatabase.AddInParameter(dbCommand, "@State", DbType.String, objCarInfo.SellerState);
                dbDatabase.AddInParameter(dbCommand, "@Email", DbType.String, objCarInfo.SellerEmail);
                dbDatabase.AddInParameter(dbCommand, "@PhoneNum", DbType.String, objCarInfo.SellerPhone);
                dbDatabase.AddInParameter(dbCommand, "@Zip", DbType.String, objCarInfo.Zip);
                dbDatabase.AddInParameter(dbCommand, "@DealerCode", DbType.String, objCarInfo.DealerCode);
                dbDatabase.AddInParameter(dbCommand, "@DealerInventoryID", DbType.String, objCarInfo.DealerInventoryID);
                dbDatabase.AddInParameter(dbCommand, "@UID", DbType.Int32, UID);

                //objUsedCars.Executing stored procedure
                ds = dbDatabase.ExecuteDataSet(dbCommand);
                // DataSet  ds =dbDatabase.ExecuteDataSet(dbCommand);

            }
            catch (Exception ex)
            {

            }
            finally
            {

            }

            return ds;
        }
Ejemplo n.º 2
0
        public List<UCEDealerInfo> UploadCar(DealerSiteCarInfo objCarInfo)
        {
            var objList = new List<UCEDealerInfo>();
            try
            {
                string DealerCode = objCarInfo.DealerCode.ToString().Trim();
                string UserName = objCarInfo.DealerEmailID.ToString().Trim();
                string Password = objCarInfo.DealerPwd.ToString().Trim();
                string UID = string.Empty;

                UCEDealerSiteBL objDealer = new UCEDealerSiteBL();
                DataSet dsDealer = objDealer.PerformLoginIntoUCE(UserName, DealerCode, Password);
                if (dsDealer.Tables.Count > 0)
                {
                    if (dsDealer.Tables[0].Rows.Count > 0)
                    {
                        //CarsBL.Dealer.DealerActions objActions = new CarsBL.Dealer.DealerActions();
                        UID = dsDealer.Tables[0].Rows[0]["UID"].ToString();
                        DealerCode = dsDealer.Tables[0].Rows[0]["DealerCode"].ToString();
                        DataSet dsCheckUser = objDealer.DealerCheckUniqueID(objCarInfo.DealerInventoryID, DealerCode);
                        if (dsCheckUser.Tables[0].Rows.Count > 0)
                        {
                            UCEDealerInfo objInfo = new UCEDealerInfo();
                            objInfo.AASuccess = "8002:DealerInventory ID is existed";
                            objInfo.DealerCode = DealerCode;
                            objInfo.UID = Convert.ToInt32(UID);
                            objList.Add(objInfo);
                        }
                        else
                        {
                            DataSet ds = objDealer.SaveCarDetailsToUCE(objCarInfo, UID);
                            if (ds.Tables.Count > 0)
                            {
                                if (ds.Tables[0].Rows.Count > 0)
                                {
                                    UCEDealerInfo objDealerCarInfo = new UCEDealerInfo();
                                    objDealerCarInfo.AASuccess = "8000:Car details updated successfully";
                                    objDealerCarInfo.CarID = Convert.ToInt32(ds.Tables[0].Rows[0]["carID"].ToString());
                                    objDealerCarInfo.CarUniqueID = Convert.ToInt64(ds.Tables[0].Rows[0]["CarUniqueID"].ToString());
                                    objDealerCarInfo.DealerCode = ds.Tables[0].Rows[0]["DealerCode"].ToString();
                                    objDealerCarInfo.DealerInventoryID = ds.Tables[0].Rows[0]["DealerUniqueID"].ToString();
                                    objDealerCarInfo.CarStatus = ds.Tables[0].Rows[0]["Adstatus"].ToString();
                                    objDealerCarInfo.UID = Convert.ToInt32(UID);
                                    objList.Add(objDealerCarInfo);
                                }
                                else
                                {
                                    UCEDealerInfo objDealerCarInfo = new UCEDealerInfo();
                                    objDealerCarInfo.AASuccess = "8003:Car details not updated successfully";
                                    objDealerCarInfo.DealerCode = DealerCode;
                                    objDealerCarInfo.UID = Convert.ToInt32(UID);
                                    objList.Add(objDealerCarInfo);

                                }

                            }
                            else
                            {
                                UCEDealerInfo objDealerCarInfo = new UCEDealerInfo();
                                objDealerCarInfo.AASuccess = "8003:Car details not updated successfully";
                                objDealerCarInfo.DealerCode = DealerCode;
                                objDealerCarInfo.UID = Convert.ToInt32(UID);
                                objList.Add(objDealerCarInfo);
                            }

                        }

                    }
                    else
                    {
                        UCEDealerInfo objInfo = new UCEDealerInfo();
                        objInfo.AASuccess = "8001:DealerCode,Username,password not existed";
                        objInfo.DealerCode = DealerCode;
                        objList.Add(objInfo);
                    }
                }
                else
                {
                    UCEDealerInfo objInfo = new UCEDealerInfo();
                    objInfo.AASuccess = "8001:DealerCode,Username,password not existed";
                    objInfo.DealerCode = DealerCode;
                    objList.Add(objInfo);
                }

            }
            catch (Exception ex)
            {
            }
            return objList;
        }