Ejemplo n.º 1
0
 public ActionResult Create(Company company)
 {
     if (ModelState.IsValid)
     {
         if (Session["Logo"] != null)
         {
             var fileName = Session["Logo"].ToString();
             var physicalPath = Path.Combine(Server.MapPath(Constants.Paths.TemporaryFileUploadPath), fileName);
             company.Logo = Utility.ReadFile(physicalPath);
         }
         if (company.CompanyRatingScaleID <= 0)
         {
             company.CompanyRatingScaleID = null;
         }
         company.CompanyDisplayId = MiscUtility.GetCompanyPersonalizedId();
         companyRepository.InsertOrUpdate(company);
         companyRepository.Save();
         return RedirectToAction("Index");
     }
     else
     {
         ViewBag.PossibleIndustries = industryRepository.All;
         ViewBag.PossibleCountries = countryRepository.All;
         ViewBag.PossibleCompanyOwners = companyownerRepository.All;
         ViewBag.PossibleCompanyStatusCategories = companystatuscategoryRepository.All;
         return View(company);
     }
 }
Ejemplo n.º 2
0
 public ActionResult Create()
 {
     Company company = new Company();
     ViewBag.PossibleIndustries = industryRepository.All;
     ViewBag.PossibleCountries = countryRepository.All;
     ViewBag.PossibleStates = stateRepository.All;
     ViewBag.PossibleCompanyOwners = companyownerRepository.All;
     ViewBag.PossibleCompanyStatusCategories = companystatuscategoryRepository.All;
     company.CreatedDate = DateTime.Now;
     company.CreatedByUserID = CurrentLoggedInUser.UserID;
     return View(company);
 }
Ejemplo n.º 3
0
 public CompanyOverviewHeadViewModel FindOverviewHead(int id, Company company)
 {
     if (company == null)
     {
         company = Find(id);
     }
     if (company != null)
     {
         CompanyOverviewHeadViewModel newHead = new CompanyOverviewHeadViewModel();
         newHead.Address = company.Address1;
         newHead.CompanyDisplayId = company.CompanyDisplayId;
         newHead.CompanyEmailAddress = company.CompanyEmailAddress;
         newHead.CompanyID = company.CompanyID;
         newHead.CompanyName = company.CompanyName;
         newHead.CompanyRatingScaleIDForHeader = company.CompanyRatingScaleID;
         if (company.CompanyStatusCategory != null)
         {
             newHead.CompanyStatusCategoryName = company.CompanyStatusCategory.Name;
         }
         newHead.EmployeeSize = company.EmployeeSize;
         newHead.FaxNumber = company.FaxNumber;
         if (company.Industry != null)
         {
             newHead.IndustryName = company.Industry.Name;
         }
         newHead.Location = MiscUtility.GetLocation(company.City, company.State, company.Country);
         newHead.MainOfficePhone = company.MainOfficePhone;
         newHead.WebAddress = company.WebAddress;
         return newHead;
     }
     return null;
 }
Ejemplo n.º 4
0
 public void InsertOrUpdate(Company company)
 {
     if (company.CompanyID == default(int)) {
         // New entity
         context.Company.Add(company);
     } else {
         // Existing entity
         context.Entry(company).State = EntityState.Modified;
     }
 }
Ejemplo n.º 5
0
 public ViewResult Search(Company searchCompany)
 {
     if (searchCompany != null)
     {
         ViewData["CompanyName"] = searchCompany.CompanyName;
         ViewData["CompanyDisplayId"] = searchCompany.CompanyDisplayId;
         ViewData["IndustryID"] = searchCompany.IndustryID;
         ViewData["CountryID"] = searchCompany.CountryID;
         ViewData["StateID"] = searchCompany.StateID;
         ViewData["CompanyStatusCategoryID"] = searchCompany.CompanyStatusCategoryID;
     }
     ViewBag.PossibleIndustries = industryRepository.All;
     ViewBag.PossibleCountries = countryRepository.All;
     ViewBag.PossibleStates = stateRepository.All;
     ViewBag.PossibleCompanyStatusCategories = companystatuscategoryRepository.All;
     return View("Index", companyRepository.AllIncluding(company => company.Industry, company => company.Country, company => company.State, company => company.CompanyOwner, company => company.CompanyStatusCategory, company => company.CreatedByUser, company => company.VerifiedByUser));
 }