public void DeleteAuctionHouseCarSellingVehicleImage(AuctionHouseCarSellingVehicleImages auctionHouseCarSellingVehicleImage)
        {
            if (auctionHouseCarSellingVehicleImage == null)
                throw new ArgumentNullException("AuctionHouseSaleVehicleImage");
            else {
                AuctionHouseCarSellingVehicleImages result = _auctionHouseCarSellingVehicleImagesRepository.GetById(auctionHouseCarSellingVehicleImage.AuctionHouseCarSellingVehicleImagesID);

                _auctionHouseCarSellingVehicleImagesRepository.Delete(result);
            }
        }
        public ActionResult UploadVehicleImageEdit(string ctrlID, long AuctionHouseVehicleID)
        {
            if (Session["AuctionHouseVehicleID"] != null)
            {
                long ID = Convert.ToInt64(Session["AuctionHouseVehicleID"]);
                if (Request.Files.Count > 0)
                {
                    var Idfile = Request.Files[0];
                    if (Idfile != null && Idfile.ContentLength > 0)
                    {
                        var filename = Path.GetFileName(Idfile.FileName);
                        string extension = Path.GetExtension(Idfile.FileName);
                        string fName = DateTime.Now.ToString("yyyyMMdd_hhss") + extension;
                        var path = Path.Combine(Server.MapPath("~/Content/Assets/AuctionHouseSaleVehicleImages/"), fName);
                        Idfile.SaveAs(path);
                        AuctionHouseCarSellingVehicleImages img = new AuctionHouseCarSellingVehicleImages();
                        img.AuctionHouseCarSellingID = ID;

                        img.Filename = fName;
                        img.Size = 0;
                        img.Foldername = "~/Content/Assets/AuctionHouseSaleVehicleImages/";

                        _auctionHouseCarSellingVehicleImagesService.InsertAuctionHouseCarSellingVehicleImage(img);

                        return Json(fName, JsonRequestBehavior.AllowGet);
                    }

                }
            }
            return Json(false, JsonRequestBehavior.AllowGet);
        }
        public ActionResult GetVehicleImage(string AuctionHouseVehicleID)
        {
            if (Session["AuctionHouseVehicleID"] != null)
            {
                long ID = Convert.ToInt64(Session["AuctionHouseVehicleID"]);
                if (Request.Files.Count > 0)
                {
                    var Idfile = Request.Files[0];
                    if (Idfile != null && Idfile.ContentLength > 0)
                    {
                        var filename = Path.GetFileName(Idfile.FileName);
                        string extension = Path.GetExtension(Idfile.FileName);
                        string fName = DateTime.Now.ToString("yyyyMMdd_hhss") + extension;
                        var path = Path.Combine(Server.MapPath("~/Content/Assets/AuctionHouseSaleVehicleImages/"), fName);
                        Idfile.SaveAs(path);
                        AuctionHouseCarSellingVehicleImages model = new AuctionHouseCarSellingVehicleImages();
                        model.AuctionHouseCarSellingID = ID;
                        model.Filename = "";
                        model.Filename = fName;
                        model.Size = 0;
                        model.Foldername = "~/Content/Assets/AuctionHouseSaleVehicleImages/";

                        IList<AuctionHouseCarSellingVehicleImages> vehicleImages = _auctionHouseCarSellingVehicleImagesService.GetAuctionHouseCarSellingVehicleImages().Where(t => t.AuctionHouseCarSellingID == ID).ToList();

                        return Json(vehicleImages, JsonRequestBehavior.AllowGet);
                    }

                }
            }
            return Json(false, JsonRequestBehavior.AllowGet);
        }
Пример #4
0
        public ActionResult AddToAuction(AddToAuction addToAuction)
        {
            int _id = Convert.ToInt32(addToAuction.VehicleID);
            var varCarDetails = _carsellervehicleinfoService.GetCarSellerVehicleInfo().Where(t => t.ID == _id).FirstOrDefault();

            AuctionHouseCarSelling objAuctionHouseCarSelling = new AuctionHouseCarSelling();
            if (varCarDetails != null)
            {

                objAuctionHouseCarSelling.MakeID = varCarDetails.MakeID;
                objAuctionHouseCarSelling.ModelID = varCarDetails.ModelID;
                objAuctionHouseCarSelling.RegistrationNo = varCarDetails.RegistrationNumber;
                objAuctionHouseCarSelling.Reserve = varCarDetails.Price.ToString();
                objAuctionHouseCarSelling.AuctionHouseID = Convert.ToInt64(addToAuction.AuctionHouseID);
                objAuctionHouseCarSelling.AuctionHouseSaleID = Convert.ToInt64(addToAuction.AuctionHouseSaleID);
                objAuctionHouseCarSelling.VehicleID = varCarDetails.ID;
                objAuctionHouseCarSelling.BodyID = varCarDetails.BodyTypeID;
                objAuctionHouseCarSelling.EngineSize = varCarDetails.EngineSize;
                objAuctionHouseCarSelling.ExactMileage = varCarDetails.ExactMileage;
                objAuctionHouseCarSelling.ExteriorInteriorColour = varCarDetails.Color;
                objAuctionHouseCarSelling.TransmissionTypeIDs = varCarDetails.TransmissionTypeID.ToString();
                objAuctionHouseCarSelling.MOTExpiryDate = varCarDetails.MOTExpiryDate;
                objAuctionHouseCarSelling.TaxExpiryDate = varCarDetails.TAXExpiryDate;
                objAuctionHouseCarSelling.RegistrationDate = varCarDetails.DateOfFirstRegistration;
                objAuctionHouseCarSelling.LastServiceDetails = varCarDetails.ServiceHistory;

                var CarSellerFuelTypes = _carSellerVehicleFuelTypeService.CarSellerVehicleFuelTypeByVehicleID(varCarDetails.ID);

                string strFuelType = "";
                if (CarSellerFuelTypes.Count > 0)
                {
                    foreach (var item in CarSellerFuelTypes)
                    {
                        strFuelType += item.FuelTypeID.ToString()+",";
                    }
                    objAuctionHouseCarSelling.FuelTypeIDs = strFuelType.Trim(',');

                }

                var CarSellerImages = _carsellervehicleimageService.GetCarSellerVehicleImageByVehicleID(varCarDetails.ID).ToList();

                _auctionHouseAddEditVehicleService.InsertAuctionHouseCarSelling(objAuctionHouseCarSelling);

                 CarBuyerInfoModel model = new CarBuyerInfoModel();
                    model.AuctionHouseCarSellingID = objAuctionHouseCarSelling.AuctionHouseCarSellingID;
                if (objAuctionHouseCarSelling.AuctionHouseCarSellingID > 0)
                {
                    if (CarSellerImages != null)
                    {
                        var aucHouseVehicleImage = _auctionHouseCarSellingVehicleImagesService.GetAuctionHouseCarSellingVehicleImages().Where(t => t.AuctionHouseCarSellingID == objAuctionHouseCarSelling.AuctionHouseCarSellingID).ToList();
                        foreach (var img in CarSellerImages)
                        {

                            if (aucHouseVehicleImage.Count==0)
                            {
                                model.AuctionHouseCarSellingID = objAuctionHouseCarSelling.AuctionHouseCarSellingID;
                                model.Filename = img.Filename;
                                model.Foldername = img.Foldername;
                                model.Size = Convert.ToInt32(img.Size);

                                if (model.AuctionHouseCarSellingID != 0 && model.Filename!=null && model.Foldername!=null)
                                {
                                    AuctionHouseCarSellingVehicleImages objAuctionHouseCarSellingVehicleImage = new AuctionHouseCarSellingVehicleImages();

                                    objAuctionHouseCarSellingVehicleImage.AuctionHouseCarSellingID = model.AuctionHouseCarSellingID;
                                    objAuctionHouseCarSellingVehicleImage.Filename = model.Filename;
                                    objAuctionHouseCarSellingVehicleImage.Foldername = "~/Content/Assets/AuctionHouseSaleVehicleImages/";
                                    objAuctionHouseCarSellingVehicleImage.Size = model.Size;
                                    _auctionHouseCarSellingVehicleImagesService.InsertAuctionHouseCarSellingVehicleImage(objAuctionHouseCarSellingVehicleImage);
                                }

                            }

                        }

                    }

                    CarSellerVehicleInfo objCarSellerVehicleInfo = new CarSellerVehicleInfo();

                    objCarSellerVehicleInfo.ID = varCarDetails.ID;
                    objCarSellerVehicleInfo.IsSendToAuction = true;
                    _carsellervehicleinfoService.UpdateCarSellerVehicleInfo(objCarSellerVehicleInfo);

                }

            }
            return Json(objAuctionHouseCarSelling, JsonRequestBehavior.AllowGet);
        }
 public void UpdateAuctionHouseCarSellingVehicleImage(AuctionHouseCarSellingVehicleImages auctionHouseCarSellingVehicleImage)
 {
     if (auctionHouseCarSellingVehicleImage == null)
         throw new ArgumentNullException("AuctionHouseSaleVehicleImage");
     _auctionHouseCarSellingVehicleImagesRepository.Update(auctionHouseCarSellingVehicleImage);
 }