예제 #1
0
 public ActionResult Create(Vendor vendor)
 {
     if (ModelState.IsValid)
     {
         if (Session["Logo"] != null)
         {
             var fileName = Session["Logo"].ToString();
             var physicalPath = Path.Combine(Server.MapPath(Constants.Paths.TemporaryFileUploadPath), fileName);
             vendor.Logo = Utility.ReadFile(physicalPath);
         }
         vendor.VendorDisplayId = MiscUtility.GetVendorPersonalizedId();
         vendorRepository.InsertOrUpdate(vendor);
         vendorRepository.Save();
         return RedirectToAction("Index");
     }
     else
     {
         ViewBag.PossibleIndustries = industryRepository.All;
         ViewBag.PossibleVendorOwners = companyownerRepository.All;
         ViewBag.PossibleVendorLegalCompanyStructureCategories = vendorlegalcompanystructurecategoryRepository.All;
         ViewBag.PossibleCountries = countryRepository.All;
         ViewBag.PossibleVendorStatusCategories = vendorstatuscategoryRepository.All;
         return View(vendor);
     }
 }
예제 #2
0
 public ActionResult Create()
 {
     Vendor vendor = new Vendor();
     ViewBag.PossibleIndustries = industryRepository.All;
     ViewBag.PossibleVendorOwners = companyownerRepository.All;
     ViewBag.PossibleVendorLegalCompanyStructureCategories = vendorlegalcompanystructurecategoryRepository.All;
     ViewBag.PossibleCountries = countryRepository.All;
     ViewBag.PossibleVendorStatusCategories = vendorstatuscategoryRepository.All;
     vendor.CreatedDate = DateTime.Now;
     vendor.CreatedByUserID = CurrentLoggedInUser.UserID;
     return View(vendor);
 }
예제 #3
0
 public ActionResult Create()
 {
     Vendor vendor = new Vendor();
     ViewBag.PossibleIndustries = industryRepository.All;
     ViewBag.PossibleCompanyOwners = companyownerRepository.All;
     ViewBag.PossibleVendorLegalCompanyStructureCategories = vendorlegalcompanystructurecategoryRepository.All;
     ViewBag.PossibleCountries = countryRepository.All;
     ViewBag.PossibleStates = stateRepository.All;
     ViewBag.PossibleVendorStatusCategories = vendorstatuscategoryRepository.All;
     ViewBag.PossibleCreatedByUsers = userRepository.All;
     ViewBag.PossibleVerifiedByUsers = userRepository.All;
     return View(vendor);
 }
예제 #4
0
 public ActionResult Create(Vendor vendor)
 {
     if (ModelState.IsValid) {
         vendorRepository.InsertOrUpdate(vendor);
         vendorRepository.Save();
         return RedirectToAction("Index");
     } else {
         ViewBag.PossibleIndustries = industryRepository.All;
         ViewBag.PossibleCompanyOwners = companyownerRepository.All;
         ViewBag.PossibleVendorLegalCompanyStructureCategories = vendorlegalcompanystructurecategoryRepository.All;
         ViewBag.PossibleCountries = countryRepository.All;
         ViewBag.PossibleStates = stateRepository.All;
         ViewBag.PossibleVendorStatusCategories = vendorstatuscategoryRepository.All;
         ViewBag.PossibleCreatedByUsers = userRepository.All;
         ViewBag.PossibleVerifiedByUsers = userRepository.All;
         return View(vendor);
     }
 }
예제 #5
0
 public ViewResult Search(Vendor searchVendor)
 {
     if(searchVendor!=null)
     {
                     ViewData["VendorDisplayId"]=searchVendor.VendorDisplayId;
                     }
                 return View("Index",vendorRepository.AllIncluding(vendor => vendor.Industry, vendor => vendor.CompanyOwner, vendor => vendor.VendorLegalCompanyStructureCategory, vendor => vendor.Country, vendor => vendor.State, vendor => vendor.VendorStatusCategory, vendor => vendor.CreatedByUser, vendor => vendor.VerifiedByUser));
 }
예제 #6
0
 public ViewResult Search(Vendor searchVendor)
 {
     if (searchVendor != null)
     {
         ViewData["VendorDisplayId"] = searchVendor.VendorDisplayId;
         ViewData["VendorName"] = searchVendor.VendorName;
         ViewData["IndustryID"] = searchVendor.IndustryID;
         ViewData["CountryID"] = searchVendor.CountryID;
         ViewData["StateID"] = searchVendor.StateID;
         ViewData["VendorStatusCategoryID"] = searchVendor.VendorStatusCategoryID;
     }
     ViewBag.PossibleIndustries = industryRepository.All;
     ViewBag.PossibleCountries = countryRepository.All;
     ViewBag.PossibleStates = stateRepository.All;
     ViewBag.PossibleVendorStatusCategories = vendorstatuscategoryRepository.All;
     return View("Index", vendorRepository.AllIncluding(vendor => vendor.Industry, vendor => vendor.VendorOwner, vendor => vendor.VendorLegalCompanyStructureCategory, vendor => vendor.Country, vendor => vendor.State, vendor => vendor.VendorStatusCategory, vendor => vendor.CreatedByUser, vendor => vendor.VerifiedByUser));
 }
예제 #7
0
 public VendorOverviewHeadViewModel FindOverviewHead(int id, Vendor vendor)
 {
     if (vendor == null)
     {
         vendor = Find(id);
     }
     if (vendor != null)
     {
         VendorOverviewHeadViewModel newHead = new VendorOverviewHeadViewModel();
         newHead.Address = vendor.Address1;
         newHead.VendorDisplayId = vendor.VendorDisplayId;
         newHead.VendorEmailAddress = vendor.VendorEmailAddress;
         newHead.VendorID = vendor.VendorID;
         newHead.VendorName = vendor.VendorName;
         if (vendor.VendorLegalCompanyStructureCategory != null)
         {
             newHead.VendorLegalCompanyStructureCategoryName = vendor.VendorLegalCompanyStructureCategory.Name;
         }
         if (vendor.VendorStatusCategory != null)
         {
             newHead.VendorStatusCategoryName = vendor.VendorStatusCategory.Name;
         }
         newHead.EmployeeSize = vendor.EmployeeSize;
         newHead.FaxNumber = vendor.FaxNumber;
         if (vendor.Industry != null)
         {
             newHead.IndustryName = vendor.Industry.Name;
         }
         newHead.Location = MiscUtility.GetLocation(vendor.City, vendor.State, vendor.Country);
         newHead.MainOfficePhone = vendor.MainOfficePhone;
         newHead.WebAddress = vendor.WebAddress;
         return newHead;
     }
     return null;
 }
예제 #8
0
 public void InsertOrUpdate(Vendor vendor)
 {
     if (vendor.VendorID == default(int))
     {
         // New entity
         context.Vendor.Add(vendor);
     }
     else
     {
         // Existing entity
         context.Entry(vendor).State = EntityState.Modified;
     }
 }