public ActionResult Detail(int id)
        {
            //var SearchCriteria = new HomeViewModel();
            //SearchCriteria.LocationID = ;

            int VendorCode = Convert.ToInt32(id);

            var objVendorDetail = new VendorDetailViewModel();

            objVendorDetail = (from vendor in db.tblVendors

                               //from vendorCategory in vendor.tblCategories
                               //join category in db.tblCategories on vendorCategory.CategoryID equals category.CategoryID
                               join a in db.tblAreas on vendor.AreaCode equals a.AreaCode

                               //join i in db.tblImages on v.VendorID equals i.VendorID
                               where vendor.VendorID == VendorCode
                               select new VendorDetailViewModel()
            {
                VendorName = vendor.VendorName,
                VendorPriceRangeMinimum = vendor.VendorPriceRangeMinimum,
                VendorPriceRangeMaximum = vendor.VendorPriceRangeMaximum,
                VendorCapacityMinimum = vendor.VendorCapacityMinimum,
                VendorCapacityMaximum = vendor.VendorCapacityMaximum,
                VendorDescription = vendor.VendorDescription,
                Area = a.AreaDescription,
                VendorAddress = vendor.VendorAddress,
            }).SingleOrDefault();

            List <string> ImageSources = (from vendor in db.tblVendors
                                          from vendorImages in vendor.tblImages
                                          where vendorImages.VendorID == VendorCode
                                          select vendorImages.ImageDetail).ToList();


            List <string> Facilites = (from vendor in db.tblVendors

                                       from vendorFacility in vendor.tblFacilities
                                       join facility in db.tblFacilities on vendorFacility.FacilityID equals facility.FacilityID into ps
                                       from facility in ps.DefaultIfEmpty()
                                       where vendor.VendorID == VendorCode

                                       select(facility == null) ? "No Facilities" : facility.FacilityName).ToList();

            objVendorDetail.Facility          = Facilites;
            objVendorDetail.VendorImageSource = ImageSources;



            return(View(objVendorDetail));
        }
Beispiel #2
0
        public ActionResult Details(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(HttpNotFound());
            }

            var dataVendor = _vendorBLL.GetById(id);
            var model      = new VendorDetailViewModel()
            {
                Detail      = dataVendor,
                MainMenu    = _mainMenu,
                CurrentMenu = PageInfo
            };

            return(View(model));
        }
Beispiel #3
0
        public IActionResult VendorList()
        {
            VendorListViewModel list = new VendorListViewModel();

            list.List = new List <VendorDetailViewModel>();

            var vendors = userManager.GetUsersInRoleAsync("Vendor").Result;

            foreach (var vendor in vendors)
            {
                VendorDetailViewModel model = new VendorDetailViewModel();

                model = GetVendorDetail(vendor.Id);
                //model.CreatedDate = vendor.CreateDate.DateTime;

                list.List.Add(model);
            }
            return(View(list));
        }
Beispiel #4
0
        public VendorDetailViewModel GetVendorDetail(string Id)
        {
            var storeDetail             = _context.Vendors.Find(Id);
            var totalProducts           = _context.Products.Where(p => p.VendorId == Id).Count();
            VendorDetailViewModel model = new VendorDetailViewModel();

            model.VendorId = Id;
            if (storeDetail != null)
            {
                model.StoreName = storeDetail.StoreName;
            }
            else
            {
                model.StoreName = "Store not set";
            }
            model.TotalProducts = totalProducts;
            model.Revenue       = GetTotalSell(true, Id);

            return(model);
        }
        public ActionResult SearchVendorDetail(int VendorId)
        {
            VendorDetailViewModel sp = new VendorDetailViewModel();

            if (TempData["CheckInVendorSearch"] != null)
            {
                TempData["CheckInVendorSearch"] = TempData["CheckInVendorSearch"];
            }
            if (TempData["AddToWishVendorSearch"] != null)
            {
                TempData["AddToWishVendorSearch"] = TempData["AddToWishVendorSearch"];
            }
            if (TempData["BlockMessageSearch"] != null)
            {
                TempData["BlockMessageSearch"] = TempData["BlockMessageSearch"];
            }
            if (VendorId != 0)
            {
                var o = (from c in entity.Vendors
                         join e in entity.VendorPictures on c.VendorProfilePicId
                         equals e.VendorPictureId into ppl
                         from e in ppl.DefaultIfEmpty()

                         join f in entity.Countries on c.CountryId equals f.CountryId
                         join g in entity.Cities on c.CityId equals g.CityId
                         join k in entity.VendorTypes on c.VendorTypeId equals k.VendorTypeId
                         where c.VendorId == VendorId
                         orderby c.VendorFavourite descending
                         select new
                {
                    c.VendorId,
                    c.VendorOfficeName,
                    e.VendorPictureData,
                    c.VendorOfficeAddress,
                    c.VendorOfficeWebsite,
                    c.VendorOfficePhnNo,
                    k.VendorTypeId,
                    k.VendorTypeName,
                    c.CountryId,
                    c.CityId,
                    c.VendorFavourite,
                    c.VendorsVendorShipDetail,
                    g.CityName,
                    f.CountryName,

                    c.VendorOfferStatus,
                    c.VendorsStatus,
                    c.VendorAdminsPermit
                }).First();

                if (o != null)
                {
                    sp.VendorId          = o.VendorId;
                    sp.VendorName        = o.VendorOfficeName;
                    sp.VendorAddress     = o.VendorOfficeAddress;
                    sp.VendorPhnNo       = o.VendorOfficePhnNo;
                    sp.VendorWebsite     = o.VendorOfficeWebsite;
                    sp.VendorTypeId      = Convert.ToInt32(o.VendorTypeId);
                    sp.VendorTypeName    = o.VendorTypeName;
                    sp.CityId            = Convert.ToInt32(o.CityId);
                    sp.CityName          = o.CityName;
                    sp.CountryId         = Convert.ToInt32(o.CountryId);
                    sp.CountryName       = o.CountryName;
                    sp.VendorPictureData = o.VendorPictureData;
                    sp.VendorStatus      = Convert.ToBoolean(o.VendorsStatus);
                    sp.VendorOfferStatus = Convert.ToBoolean(o.VendorOfferStatus);
                    string VendorShortDetail = CutDetail.StripHTML(o.VendorsVendorShipDetail);
                    sp.VendorShortDetail = CutDetail.Truncate(VendorShortDetail, 40);
                    sp.VendorFullDetail  = o.VendorsVendorShipDetail;
                    sp.VendorLike        = Convert.ToInt32(o.VendorFavourite);

                    sp.VendorAdminPermit = Convert.ToBoolean(o.VendorAdminsPermit);
                }
                var q = sp;

                return(View(q));
            }

            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
        public ActionResult SearchVendorList(int VendorTypeId, int CountryId, int CityId)
        {
            List <VendorDetailViewModel> sp = new List <VendorDetailViewModel>();

            Session["SearchVendorList"] = "yes";
            Session["VendorTypeId"]     = VendorTypeId;
            var p = (from c in entity.Vendors
                     join e in entity.VendorPictures on c.VendorProfilePicId
                     equals e.VendorPictureId into ppl
                     from e in ppl.DefaultIfEmpty()

                     join f in entity.Countries on c.CountryId equals f.CountryId
                     join g in entity.Cities on c.CityId equals g.CityId
                     join k in entity.VendorTypes on c.VendorTypeId equals k.VendorTypeId
                     where c.VendorTypeId == VendorTypeId && c.VendorsStatus == true && c.VendorAdminsPermit == true && c.CountryId == CountryId && c.CityId == CityId
                     orderby c.VendorFavourite descending
                     select new
            {
                c.VendorId,
                c.VendorOfficeName,
                e.VendorPictureData,
                c.VendorOfficeAddress,
                c.VendorOfficeWebsite,
                c.VendorOfficePhnNo,
                k.VendorTypeId,
                k.VendorTypeName,
                c.CountryId,
                c.CityId,
                c.VendorFavourite,
                c.VendorsVendorShipDetail,
                g.CityName,
                f.CountryName,

                c.VendorOfferStatus,
                c.VendorsStatus,
                c.VendorAdminsPermit
            }).ToList();

            int x = p.Count();

            if (x > 0)
            {
                foreach (var o in p)
                {
                    VendorDetailViewModel oivm = new VendorDetailViewModel();
                    oivm.VendorId          = o.VendorId;
                    oivm.VendorName        = o.VendorOfficeName;
                    oivm.VendorAddress     = o.VendorOfficeAddress;
                    oivm.VendorPhnNo       = o.VendorOfficePhnNo;
                    oivm.VendorWebsite     = o.VendorOfficeWebsite;
                    oivm.VendorTypeId      = Convert.ToInt32(o.VendorTypeId);
                    oivm.VendorTypeName    = o.VendorTypeName;
                    oivm.CityId            = Convert.ToInt32(o.CityId);
                    oivm.CityName          = o.CityName;
                    oivm.CountryId         = Convert.ToInt32(o.CountryId);
                    oivm.CountryName       = o.CountryName;
                    oivm.VendorPictureData = o.VendorPictureData;
                    oivm.VendorStatus      = Convert.ToBoolean(o.VendorsStatus);
                    oivm.VendorOfferStatus = Convert.ToBoolean(o.VendorOfferStatus);
                    string VendorShortDetail = CutDetail.StripHTML(o.VendorsVendorShipDetail);
                    oivm.VendorShortDetail = CutDetail.Truncate(VendorShortDetail, 40);
                    oivm.VendorFullDetail  = o.VendorsVendorShipDetail;
                    oivm.VendorLike        = Convert.ToInt32(o.VendorFavourite);

                    oivm.VendorAdminPermit = Convert.ToBoolean(o.VendorAdminsPermit);
                    sp.Add(oivm);
                }
                var q = sp;


                return(View(q));
            }
            else
            {
                TempData["Vendor"] = "No data found";
                return(RedirectToAction("Index", "Home"));
            }
        }