// GET: /JobDetails/ public ActionResult Index(string id = "", string marketguid = "", string jobindexguid = "") { Logger.Debug("Inside People Controller- Create"); try { if (Session["OrganizationGUID"] != null) { if (!string.IsNullOrEmpty(jobindexguid)) { if (!string.IsNullOrEmpty(id)) { TempData["TabName"] = id; } else { TempData["TabName"] = "Details"; } DropdownValues(); Job _job = _IJobRepository.GetJobByID(new Guid(jobindexguid)); JobModel job = new JobModel(); job.JobIndexGUID = _job.JobGUID; // job.JobLogicalID = _IJobSchemaRepository.GetJobFormIDfromJobForm(_job.JobForm.ToString()); job.JobReferenceNo = _job.JobReferenceNo; job.JobName = _job.JobName; if (_job.CustomerGUID != null && !string.IsNullOrEmpty(_job.CustomerGUID.ToString())) { job.CustGUID = new Guid(_job.CustomerGUID.ToString()); } else { job.CustGUID = Guid.Empty; } job.IsScheduled = _job.IsSecheduled == true ? "true" : "false"; double duration; if (double.TryParse(_job.EstimatedDuration.ToString(), out duration)) { TimeSpan time = new TimeSpan(); time = TimeSpan.FromSeconds(duration); //timeformat = time.Hours + " : " + time.Minutes + " : " + time.Seconds; job.Duration = time.Hours + " : " + time.Minutes; job.EstimatedDuration = duration; //job.EstimatedDuration = duration / 3600; } else { job.EstimatedDuration = 0; } job.PreferredStartTime = _job.PreferedStartTime != null ? Session["TimeZoneID"] != null ? _IUserRepository.GetLocalDateTime(_job.PreferedStartTime, Session["TimeZoneID"].ToString()) : _job.PreferedStartTime.ToString() : ""; job.PreferredStartTime = !string.IsNullOrEmpty(job.PreferredStartTime) ? _IUserRepository.GetLocalDateTime(_job.PreferedStartTime, Session["TimeZoneID"].ToString()) : ""; job.PreferredStartTime = !string.IsNullOrEmpty(job.PreferredStartTime) ? Convert.ToDateTime(job.PreferredStartTime).ToString("MM/dd/yy HH:mm") : ""; job.PreferredEndTime = _job.PreferedEndTime != null ? Session["TimeZoneID"] != null ? _IUserRepository.GetLocalDateTime(_job.PreferedEndTime, Session["TimeZoneID"].ToString()) : _job.PreferedEndTime.ToString() : ""; job.PreferredEndTime = !string.IsNullOrEmpty(job.PreferredEndTime) ? _IUserRepository.GetLocalDateTime(_job.PreferedEndTime, Session["TimeZoneID"].ToString()) : ""; job.PreferredEndTime = !string.IsNullOrEmpty(job.PreferredEndTime) ? Convert.ToDateTime(job.PreferredEndTime).ToString("MM/dd/yy HH:mm") : ""; job.ActualStartTime = _job.ActualStartTime != null ? Session["TimeZoneID"] != null ? _IUserRepository.GetLocalDateTime(_job.ActualStartTime, Session["TimeZoneID"].ToString()) : _job.ActualStartTime.ToString() : ""; job.ActualStartTime = !string.IsNullOrEmpty(job.ActualStartTime) ? _IUserRepository.GetLocalDateTime(_job.ActualStartTime, Session["TimeZoneID"].ToString()) : ""; job.ActualStartTime = !string.IsNullOrEmpty(job.ActualStartTime) ? Convert.ToDateTime(job.ActualStartTime).ToString("MM/dd/yy HH:mm") : ""; job.ActualEndTime = _job.PreferedEndTime != null ? Session["TimeZoneID"] != null ? _IUserRepository.GetLocalDateTime(_job.ActualEndTime, Session["TimeZoneID"].ToString()) : _job.ActualEndTime.ToString() : ""; job.ActualEndTime = !string.IsNullOrEmpty(job.ActualEndTime) ? _IUserRepository.GetLocalDateTime(_job.ActualEndTime, Session["TimeZoneID"].ToString()) : ""; job.ActualEndTime = !string.IsNullOrEmpty(job.ActualEndTime) ? Convert.ToDateTime(job.ActualEndTime).ToString("MM/dd/yy HH:mm") : ""; //job.PreferredStartTime = _IUserRepository.GetLocalDateTime(_job.PreferedStartTime, Session["TimeZoneID"].ToString()); //job.PreferredStartTime = !string.IsNullOrEmpty(job.PreferredStartTime) ? Convert.ToDateTime(job.PreferredStartTime).ToString("MM/dd/yyyy HH:mm") : ""; //job.PreferredEndTime = _IUserRepository.GetLocalDateTime(_job.PreferedEndTime, Session["TimeZoneID"].ToString()); //job.PreferredEndTime = !string.IsNullOrEmpty(job.PreferredEndTime) ? Convert.ToDateTime(job.PreferredEndTime).ToString("MM/dd/yyyy HH:mm") : ""; //job.PreferredEndTime = Convert.ToDateTime(_job.PreferedEndTime).ToString("yyyy/MM/dd HH:mm"); if (_job.RegionGUID != null) job.RegionCode = new Guid(_job.RegionGUID.ToString()); else job.RegionCode = Guid.Empty; if (_job.TerritoryGUID != null) job.TerritoryCode = new Guid(_job.TerritoryGUID.ToString()); else job.TerritoryCode = Guid.Empty; if (_job.CustomerStopGUID != null && !string.IsNullOrEmpty(_job.CustomerStopGUID.ToString())) { job.StopsGUID = new Guid(_job.CustomerStopGUID.ToString()); } else { job.StopsGUID = Guid.Empty; } job.CustomerName = job.CustGUID != Guid.Empty ? _IJobRepository.GetCustomerName(job.CustGUID) : ""; job.CreateDate = _job.CreateDate; int StatusCode; ; if (int.TryParse(_job.StatusCode.ToString(), out StatusCode)) { job.Status = StatusCode; } else { job.Status = 0; } var placeList = new PlaceViewModel(); placeList.PlaceList = new List<PlaceModel>(); var appPlace = new List<Place>(); appPlace = _IPlaceRepository.GetPlaceByOrganizationGUID(new Guid(Session["OrganizationGUID"].ToString())).ToList(); placeList.PlaceList.Add(new PlaceModel { PlaceGUID = Guid.Empty.ToString(), PlaceName = "All", UserGUID = "", OrganizationGUID = "", }); foreach (var place in appPlace.ToList()) { placeList.PlaceList.Add(new PlaceModel { PlaceGUID = place.PlaceGUID.ToString(), PlaceID = place.PlaceID, PlaceName = place.PlaceName, UserGUID = place.UserGUID.ToString(), OrganizationGUID = place.OrganizationGUID.ToString(), }); } var marketList = new MarketViewModel(); marketList.MarketList = new List<MarketModel>(); var appMarket = new List<Market>(); if (string.IsNullOrEmpty(marketguid) || Guid.Empty == new Guid(marketguid)) { // if (Session["UserType"].ToString() == "ENT_A") { appMarket = _IMarketRepository.GetMarketByOrganizationGUID(new Guid(Session["OrganizationGUID"].ToString()), 1).ToList(); } //else //{ // appMarket = _IMarketRepository.GetMarketByUserGUID(new Guid(Session["UserGUID"].ToString()), 1).ToList(); //} if (!string.IsNullOrEmpty(marketguid) && Guid.Empty == new Guid(marketguid)) ViewBag.PlaceGUID = Guid.Empty.ToString(); } else { appMarket = _IMarketRepository.GetMarketByOwnerGUID(new Guid(marketguid)).ToList(); ViewBag.PlaceGUID = marketguid; } foreach (var market in appMarket.ToList()) { marketList.MarketList.Add(new MarketModel { MarketGUID = market.MarketGUID.ToString(), UserGUID = market.UserGUID.ToString(), OrganizationGUID = market.OrganizationGUID.ToString(), OwnerGUID = market.OwnerGUID.ToString(), MarketName = market.MarketName, MarketPhone = market.MarketPhone, PrimaryContactGUID = market.PrimaryContactGUID.ToString(), FirstName = market.FirstName, LastName = market.LastName, MobilePhone = market.MobilePhone, HomePhone = market.HomePhone, Emails = market.Emails, AddressLine1 = market.AddressLine1, AddressLine2 = market.AddressLine2, City = market.City, State = market.State, Country = market.Country, ZipCode = market.ZipCode, RegionGUID = market.RegionGUID != null ? market.RegionGUID.ToString() : Guid.Empty.ToString(), TerritoryGUID = market.TerritoryGUID != null ? market.TerritoryGUID.ToString() : Guid.Empty.ToString(), RegionName = market.RegionGUID != null ? _IRegionRepository.GetRegionNameByRegionGUID(new Guid(market.RegionGUID.ToString())) : "", TerritoryName = market.TerritoryGUID != null ? _ITerritoryRepository.GetTerritoryNameByTerritoryGUID(new Guid(market.TerritoryGUID.ToString())) : "", }); } List<JobProgressViewModel> pJobProgressViewModel = new List<JobProgressViewModel>(); pJobProgressViewModel = getJobProgress(jobindexguid); var viewModel = new JobViewModel(); viewModel.Place = placeList.PlaceList; viewModel.Market = marketList.MarketList; viewModel.JobModel = job; viewModel.JobProgressList = pJobProgressViewModel; return View(viewModel); } else { return RedirectToAction("Index", "JobDetails", new { id = "Details" }); } } else { return RedirectToAction("SessionTimeOut", "User"); } } catch (Exception ex) { Logger.Error(ex.Message); return RedirectToAction("Login", "User"); } }
public ActionResult EditJobDetails(JobViewModel _jobdetails) { Logger.Debug("Inside People Controller- Create"); try { if (Session["OrganizationGUID"] != null) { List<JobProgressViewModel> pJobProgressViewModel = new List<JobProgressViewModel>(); TempData["TabName"] = "Details"; DropdownValues(); JobViewModel _job = _jobdetails; if (ModelState.IsValid) { Job job = new Job(); job.JobGUID = new Guid(_job.JobModel.JobIndexGUID.ToString()); Int16 jobclass; if (_job.JobModel.JobClass != null && !string.IsNullOrEmpty(_job.JobModel.JobClass)) { string[] pjobclass = _job.JobModel.JobClass.Split(','); if (pjobclass.Count() > 1) { if (short.TryParse(pjobclass[0], out jobclass)) { job.JobClass = jobclass; } job.JobForm = _IJobSchemaRepository.GetJobSchemabyJobFormID(new Guid(pjobclass[1])).JobForm1; } } //job.JobFormGUID = _job.JobModel.JobLogicalID; // job.JobID = 0; job.JobReferenceNo = _job.JobModel.JobReferenceNo; job.IsDeleted = false; job.OrganizationGUID = new Guid(Session["OrganizationGUID"].ToString()); if (_job.JobModel.RegionCode != Guid.Empty) { job.RegionGUID = _job.JobModel.RegionCode; } else { job.RegionGUID = null; } if (_job.JobModel.TerritoryCode != Guid.Empty) { job.TerritoryGUID = _job.JobModel.TerritoryCode; } else { job.TerritoryGUID = null; } job.LocationType = 1; if (_job.JobModel.CustGUID != Guid.Empty) { job.CustomerGUID = _job.JobModel.CustGUID; } else { job.CustomerGUID = null; } if (_job.JobModel.StopsGUID != Guid.Empty) { job.CustomerStopGUID = _job.JobModel.StopsGUID; } else { job.CustomerStopGUID = null; } if (job.CustomerStopGUID != null) { Market Market = _IMarketRepository.GetMarketByID(new Guid(job.CustomerStopGUID.ToString())); LatLong latLong = new LatLong(); latLong = GetLatLngCode(Market.AddressLine1, Market.AddressLine2, Market.City, Market.State, Market.Country, Market.ZipCode); job.ServiceAddress = Market.AddressLine1 + "," + Market.AddressLine2 + "," + Market.City + "," + Market.State + "," + Market.Country + "," + Market.ZipCode; job.Latitude = latLong.Latitude; job.Longitude = latLong.Longitude; } else { job.ServiceAddress = ""; job.Latitude = null; job.Longitude = null; } job.StatusCode = 1; job.JobName = _job.JobModel.JobName; job.IsSecheduled = _job.JobModel.IsScheduled == "true" ? true : false; job.ManagerUserGUID = new Guid(Session["UserGUID"].ToString()); double duration; if (double.TryParse(_job.JobModel.EstimatedDuration.ToString(), out duration)) job.EstimatedDuration = duration * 3600; else job.EstimatedDuration = 0; job.ScheduledStartTime = Convert.ToDateTime(_job.JobModel.PreferredStartTime); job.PreferedStartTime = Convert.ToDateTime(_job.JobModel.PreferredStartTime); job.PreferedEndTime = Convert.ToDateTime(_job.JobModel.PreferredEndTime); job.ActualStartTime = Convert.ToDateTime(_job.JobModel.ActualStartTime); job.ActualEndTime = Convert.ToDateTime(_job.JobModel.ActualEndTime); // job.JobForm = _IJobSchemaRepository.GetJobSchemabyJobFormID(_job.JobModel.JobLogicalID).JobForm1; job.CreateDate = DateTime.UtcNow; job.CreateBy = new Guid(Session["UserGUID"].ToString()); job.LastModifiedDate = DateTime.UtcNow; job.LastModifiedBy = new Guid(Session["UserGUID"].ToString()); int result = _IJobRepository.UpdateJob(job); //int result = _IJobRepository.Save(); if (result > 0) { // return RedirectToAction("Index", "JobDetails", new { jobindexguid = _job.JobModel.JobIndexGUID.ToString() }); return RedirectToAction("Index", "JobStatus"); } else { if (Session["OrganizationGUID"] != null) { Job _job1 = _IJobRepository.GetJobByID(new Guid(_job.JobModel.JobIndexGUID.ToString())); JobModel job1 = new JobModel(); job1.JobIndexGUID = _job1.JobGUID; // job1.JobLogicalID = _IJobSchemaRepository.GetJobFormIDfromJobForm(_job1.JobForm); job1.JobReferenceNo = _job1.JobReferenceNo; job1.JobName = _job1.JobName; job1.CustGUID = _job1.CustomerGUID != null ? new Guid(_job1.CustomerGUID.ToString()) : Guid.Empty; job1.IsScheduled = _job1.IsSecheduled == true ? "true" : "false"; job1.EstimatedDuration = _job1.EstimatedDuration; job1.ActualStartTime = Convert.ToDateTime(_job1.ActualStartTime).ToString("MM/dd/yy HH:mm"); job1.ActualEndTime = Convert.ToDateTime(_job1.ActualEndTime).ToString("MM/dd/yy HH:mm"); job1.PreferredStartTime = Convert.ToDateTime(_job1.PreferedStartTime).ToString("MM/dd/yy HH:mm"); job1.PreferredEndTime = Convert.ToDateTime(_job1.PreferedEndTime).ToString("MM/dd/yy HH:mm"); job1.RegionCode = _job1.RegionGUID != null ? new Guid(_job1.RegionGUID.ToString()) : Guid.Empty; job1.TerritoryCode = _job1.TerritoryGUID != null ? new Guid(_job1.TerritoryGUID.ToString()) : Guid.Empty; job1.StopsGUID = _job1.CustomerStopGUID != null ? new Guid(_job1.CustomerStopGUID.ToString()) : Guid.Empty; job1.CustomerName = _job1.CustomerGUID != null ? _IJobRepository.GetCustomerName(new Guid(_job1.CustomerGUID.ToString())) : ""; job1.CreateDate = _job1.CreateDate; int StatusCode; ; if (int.TryParse(_job1.StatusCode.ToString(), out StatusCode)) { job1.Status = StatusCode; } else { job1.Status = 0; } var placeList = new PlaceViewModel(); placeList.PlaceList = new List<PlaceModel>(); var appPlace = new List<Place>(); DropdownValues(); appPlace = _IPlaceRepository.GetPlaceByOrganizationGUID(new Guid(Session["OrganizationGUID"].ToString())).ToList(); placeList.PlaceList.Add(new PlaceModel { PlaceGUID = Guid.Empty.ToString(), PlaceName = "All", UserGUID = "", OrganizationGUID = "", }); foreach (var place in appPlace.ToList()) { placeList.PlaceList.Add(new PlaceModel { PlaceGUID = place.PlaceGUID.ToString(), PlaceID = place.PlaceID, PlaceName = place.PlaceName, UserGUID = place.UserGUID.ToString(), OrganizationGUID = place.OrganizationGUID != null ? place.OrganizationGUID.ToString() : Guid.Empty.ToString(), }); } var marketList = new MarketViewModel(); marketList.MarketList = new List<MarketModel>(); var appMarket = new List<Market>(); // if (Session["UserType"].ToString() == "ENT_A") { appMarket = _IMarketRepository.GetMarketByOrganizationGUID(new Guid(Session["OrganizationGUID"].ToString()), 1).ToList(); } //else //{ // appMarket = _IMarketRepository.GetMarketByUserGUID(new Guid(Session["UserGUID"].ToString()), 1).ToList(); //} foreach (var market in appMarket.ToList()) { marketList.MarketList.Add(new MarketModel { MarketGUID = market.MarketGUID.ToString(), UserGUID = market.UserGUID != null ? market.UserGUID.ToString() : Guid.Empty.ToString(), OrganizationGUID = market.OrganizationGUID != null ? market.OrganizationGUID.ToString() : Guid.Empty.ToString(), OwnerGUID = market.OwnerGUID != null ? market.OwnerGUID.ToString() : Guid.Empty.ToString(), MarketName = market.MarketName, MarketPhone = market.MarketPhone, PrimaryContactGUID = market.PrimaryContactGUID != null ? market.PrimaryContactGUID.ToString() : Guid.Empty.ToString(), FirstName = market.FirstName, LastName = market.LastName, MobilePhone = market.MobilePhone, HomePhone = market.HomePhone, Emails = market.Emails, AddressLine1 = market.AddressLine1, AddressLine2 = market.AddressLine2, City = market.City, State = market.State, Country = market.Country, ZipCode = market.ZipCode, RegionGUID = market.RegionGUID != null ? market.RegionGUID.ToString() : Guid.Empty.ToString(), TerritoryGUID = market.TerritoryGUID != null ? market.TerritoryGUID.ToString() : Guid.Empty.ToString(), RegionName = market.RegionGUID != null ? _IRegionRepository.GetRegionNameByRegionGUID(new Guid(market.RegionGUID.ToString())) : "", TerritoryName = market.TerritoryGUID != null ? _ITerritoryRepository.GetTerritoryNameByTerritoryGUID(new Guid(market.TerritoryGUID.ToString())) : "", }); } pJobProgressViewModel = getJobProgress(_job.JobModel.JobIndexGUID.ToString()); var viewModel = new JobViewModel(); viewModel.Place = placeList.PlaceList; viewModel.Market = marketList.MarketList; viewModel.JobProgressList = pJobProgressViewModel; viewModel.JobModel = job1; return View("Index", viewModel); //return RedirectToAction("Index", "JobDetails", new { jobindexguid = _job.JobModel.JobIndexGUID.ToString() }); } else { return RedirectToAction("../User/Login"); } } } else { if (Session["OrganizationGUID"] != null) { Job _job1 = _IJobRepository.GetJobByID(new Guid(_job.JobModel.JobIndexGUID.ToString())); JobModel job1 = new JobModel(); job1.JobIndexGUID = _job1.JobGUID; // job1.JobLogicalID = _IJobSchemaRepository.GetJobFormIDfromJobForm(_job1.JobForm); job1.JobReferenceNo = _job1.JobReferenceNo; job1.JobName = _job1.JobName; job1.CustGUID = _job1.CustomerGUID != null ? new Guid(_job1.CustomerGUID.ToString()) : Guid.Empty; job1.IsScheduled = _job1.IsSecheduled == true ? "true" : "false"; job1.EstimatedDuration = _job1.EstimatedDuration; job1.ActualStartTime = Convert.ToDateTime(_job1.ActualStartTime).ToString("MM/dd/yy HH:mm"); job1.ActualEndTime = Convert.ToDateTime(_job1.ActualEndTime).ToString("MM/dd/yy HH:mm"); job1.PreferredStartTime = Convert.ToDateTime(_job1.PreferedStartTime).ToString("MM/dd/yy HH:mm"); job1.PreferredEndTime = Convert.ToDateTime(_job1.PreferedEndTime).ToString("MM/dd/yy HH:mm"); job1.RegionCode = _job1.RegionGUID != null ? new Guid(_job1.RegionGUID.ToString()) : Guid.Empty; job1.TerritoryCode = _job1.TerritoryGUID != null ? new Guid(_job1.TerritoryGUID.ToString()) : Guid.Empty; job1.StopsGUID = _job1.CustomerStopGUID != null ? new Guid(_job1.CustomerStopGUID.ToString()) : Guid.Empty; job1.CustomerName = _job1.CustomerGUID != null ? _IJobRepository.GetCustomerName(new Guid(_job1.CustomerGUID.ToString())) : ""; job1.CreateDate = _job1.CreateDate; int StatusCode; ; if (int.TryParse(_job1.StatusCode.ToString(), out StatusCode)) { job1.Status = StatusCode; } else { job1.Status = 0; } var placeList = new PlaceViewModel(); placeList.PlaceList = new List<PlaceModel>(); var appPlace = new List<Place>(); DropdownValues(); appPlace = _IPlaceRepository.GetPlaceByOrganizationGUID(new Guid(Session["OrganizationGUID"].ToString())).ToList(); placeList.PlaceList.Add(new PlaceModel { PlaceGUID = Guid.Empty.ToString(), PlaceName = "All", UserGUID = "", OrganizationGUID = "", }); foreach (var place in appPlace.ToList()) { placeList.PlaceList.Add(new PlaceModel { PlaceGUID = place.PlaceGUID.ToString(), PlaceID = place.PlaceID, PlaceName = place.PlaceName, UserGUID = place.UserGUID.ToString(), OrganizationGUID = place.OrganizationGUID != null ? place.OrganizationGUID.ToString() : Guid.Empty.ToString(), }); } var marketList = new MarketViewModel(); marketList.MarketList = new List<MarketModel>(); var appMarket = new List<Market>(); //if (Session["UserType"].ToString() == "ENT_A") { appMarket = _IMarketRepository.GetMarketByOrganizationGUID(new Guid(Session["OrganizationGUID"].ToString()), 1).ToList(); } //else //{ // appMarket = _IMarketRepository.GetMarketByUserGUID(new Guid(Session["UserGUID"].ToString()), 1).ToList(); //} foreach (var market in appMarket.ToList()) { marketList.MarketList.Add(new MarketModel { MarketGUID = market.MarketGUID.ToString(), UserGUID = market.UserGUID != null ? market.UserGUID.ToString() : Guid.Empty.ToString(), OrganizationGUID = market.OrganizationGUID != null ? market.OrganizationGUID.ToString() : Guid.Empty.ToString(), OwnerGUID = market.OwnerGUID != null ? market.OwnerGUID.ToString() : Guid.Empty.ToString(), MarketName = market.MarketName, MarketPhone = market.MarketPhone, PrimaryContactGUID = market.PrimaryContactGUID != null ? market.PrimaryContactGUID.ToString() : Guid.Empty.ToString(), FirstName = market.FirstName, LastName = market.LastName, MobilePhone = market.MobilePhone, HomePhone = market.HomePhone, Emails = market.Emails, AddressLine1 = market.AddressLine1, AddressLine2 = market.AddressLine2, City = market.City, State = market.State, Country = market.Country, ZipCode = market.ZipCode, RegionGUID = market.RegionGUID != null ? market.RegionGUID.ToString() : Guid.Empty.ToString(), TerritoryGUID = market.TerritoryGUID != null ? market.TerritoryGUID.ToString() : Guid.Empty.ToString(), RegionName = market.RegionGUID != null ? _IRegionRepository.GetRegionNameByRegionGUID(new Guid(market.RegionGUID.ToString())) : "", TerritoryName = market.TerritoryGUID != null ? _ITerritoryRepository.GetTerritoryNameByTerritoryGUID(new Guid(market.TerritoryGUID.ToString())) : "", }); } pJobProgressViewModel = getJobProgress(_job.JobModel.JobIndexGUID.ToString()); var viewModel = new JobViewModel(); viewModel.Place = placeList.PlaceList; viewModel.Market = marketList.MarketList; viewModel.JobProgressList = pJobProgressViewModel; viewModel.JobModel = job1; return View("Index", viewModel); } else { return RedirectToAction("../User/Login"); } } } else { return RedirectToAction("SessionTimeOut", "User"); } } catch (Exception ex) { Logger.Error(ex.Message); return RedirectToAction("Login", "User"); } }
private MarketViewModel CustomerStopDetails(string PlaceGUID) { try { var marketList = new MarketViewModel(); marketList.MarketList = new List<MarketModel>(); var appMarket = new List<Market>(); appMarket = _IMarketRepository.GetMarketByOwnerGUID(new Guid(PlaceGUID)).ToList(); foreach (var market in appMarket.ToList()) { marketList.MarketList.Add(new MarketModel { MarketID = market.MarketID, MarketGUID = market.MarketGUID.ToString(), UserGUID = market.UserGUID != null ? market.UserGUID.ToString() : Guid.Empty.ToString(), OrganizationGUID = market.OrganizationGUID != null ? market.OrganizationGUID.ToString() : Guid.Empty.ToString(), OwnerGUID = market.OwnerGUID != null ? market.OwnerGUID.ToString() : Guid.Empty.ToString(), MarketName = market.MarketName, MarketPhone = market.MarketPhone, PrimaryContactGUID = market.PrimaryContactGUID != null ? market.PrimaryContactGUID.ToString() : Guid.Empty.ToString(), FirstName = market.FirstName, LastName = market.LastName, MobilePhone = market.MobilePhone, HomePhone = market.HomePhone, Emails = market.Emails, AddressLine1 = market.AddressLine1, AddressLine2 = market.AddressLine2, City = market.City, State = market.State, Country = market.Country, ZipCode = market.ZipCode, RegionGUID = market.RegionGUID != null ? market.RegionGUID.ToString() : Guid.Empty.ToString(), TerritoryGUID = market.TerritoryGUID != null ? market.TerritoryGUID.ToString() : Guid.Empty.ToString(), RegionName = market.RegionGUID != null ? _IRegionRepository.GetRegionNameByRegionGUID(new Guid(market.RegionGUID.ToString())) : "", TerritoryName = market.TerritoryGUID != null ? _ITerritoryRepository.GetTerritoryNameByTerritoryGUID(new Guid(market.TerritoryGUID.ToString())) : "", }); } var mviewModel = new MarketViewModel(); // mviewModel.Place = placeList.PlaceList.AsEnumerable(); mviewModel.Market = marketList.MarketList.AsEnumerable(); return mviewModel; } catch (Exception ex) { Logger.Error(ex.Message); return null; } }
// // GET: /CustomerView/ public ActionResult Index(string id = "", string customerid = "", string regionguid = "", string selection = "", string Contact_RowCount = "", string Store_RowCount = "", int page = 1, string Contact_Search = "", string Store_Search = "") { Logger.Debug("Inside CustomerView Controller- Index"); try { ViewBag.CustomerID = customerid; ViewBag.RegionGUID = regionguid; int contact_TotalPage = 0; int contact_TotalRecord = 0; int contact_pCount = 0; int store_TotalPage = 0; int store_TotalRecord = 0; int store_pCount = 0; if (Session["OrganizationGUID"] != null) { if (!string.IsNullOrEmpty(Contact_RowCount)) { int.TryParse(Contact_RowCount, out contact_pCount); pageContactCountList(contact_pCount); } else { pageContactCountList(contact_pCount); } if (!string.IsNullOrEmpty(Store_RowCount)) { int.TryParse(Store_RowCount, out store_pCount); pageStoreCountList(store_pCount); } else { pageStoreCountList(store_pCount); } customerview pcustomerview = new customerview(); pcustomerview.PeopleViewModel = new PeopleViewModel(); pcustomerview.MarketViewModel = new MarketViewModel(); pcustomerview.PlaceModel = new PlaceModel(); if (!string.IsNullOrEmpty(customerid)) { ViewBag.CustomerID = customerid; StringBuilder sb = new StringBuilder(); sb.Append("<div class='actions'>"); sb.Append("<div class='btn-group'>"); if (!string.IsNullOrEmpty(regionguid)) { sb.Append("<a href='#' id='ulaworkergroup' class='btn green' data-toggle='dropdown'><i class='icon-map-marker'></i> " + _IRegionRepository.GetRegionNameByRegionGUID(new Guid(regionguid)) + " <i class='icon-angle-down'></i></a>"); } else { if (!string.IsNullOrEmpty(selection) && selection == "All") { sb.Append("<a href='#' id='ulaworkergroup' class='btn green' data-toggle='dropdown'><i class='icon-map-marker'></i> All <i class='icon-angle-down'></i></a>"); } else { sb.Append("<a href='#' id='ulaworkergroup' class='btn green' data-toggle='dropdown'><i class='icon-map-marker'></i> Select Region <i class='icon-angle-down'></i></a>"); } } sb.Append("<ul id='ulworkgroup' style='height:100px;overflow-y:scroll' class='dropdown-menu pull-right'>"); if (string.IsNullOrEmpty(selection) || selection != "All") { //sb.Append("<li><a href=" + Url.Action("Index", "CustomerView", new { id = "Stores", customerid = customerid, selection = "All" }) + ">All</a></li>"); sb.Append("<li><a onclick=\"RedirectAction('Stores','');\">All</a></li>"); } List<Region> RegionList = _IRegionRepository.GetRegionByOrganizationGUID(new Guid(Session["OrganizationGUID"].ToString())).ToList(); foreach (Region item in RegionList) { //sb.Append("<li><a href=" + Url.Action("Index", "CustomerView", new { id = "Stores", customerid = customerid, regionguid = item.RegionGUID.ToString() }) + " data-groupguid=" + item.RegionGUID + ">" + item.Name + "</a></li>"); sb.Append("<li><a onclick=\"RedirectAction('Stores','" + item.RegionGUID + "','" + customerid + "');\" data-groupguid=" + item.RegionGUID + ">" + item.Name + "</a></li>"); } sb.Append("</ul>"); sb.Append("</div>"); sb.Append("</div>"); ViewBag.RegionList = sb.ToString(); Session["CustomerGUID"] = customerid; if (!string.IsNullOrEmpty(id)) { TempData["TabName"] = id; } else { TempData["TabName"] = "Details"; } #region Contact Details var peopleList = new PeopleViewModel(); peopleList.PeopleList = new List<PeopleModel>(); var appPeople = new List<Person>(); appPeople = _IPeopleRepository.GetPeopleByPlaceGUID(new Guid(customerid)).ToList(); ViewBag.PlaceGUID = customerid; if (appPeople != null && appPeople.Count > 0) { ViewBag.Contact_Search = Contact_Search; if (!string.IsNullOrEmpty(Contact_Search)) { Contact_Search = Contact_Search.ToLower(); appPeople = appPeople.Where( p => (!String.IsNullOrEmpty(p.FirstName) && p.FirstName.ToLower().StartsWith(Contact_Search)) || (!String.IsNullOrEmpty(p.BusinessPhone) && p.BusinessPhone.ToLower().StartsWith(Contact_Search)) || (!String.IsNullOrEmpty(p.MobilePhone) && p.MobilePhone.ToLower().StartsWith(Contact_Search)) || (!String.IsNullOrEmpty(p.Emails) && p.Emails.ToLower().StartsWith(Contact_Search))).ToList(); } contact_TotalRecord = appPeople.ToList().Count; contact_TotalPage = (contact_TotalRecord / (int)ViewBag.pageContactCountValue) + ((contact_TotalRecord % (int)ViewBag.pageContactCountValue) > 0 ? 1 : 0); ViewBag.Contact_TotalRows = contact_TotalRecord; appPeople = appPeople.OrderBy(a => a.OrganizationGUID).Skip(((page - 1) * (int)ViewBag.pageContactCountValue)).Take((int)ViewBag.pageContactCountValue).ToList(); foreach (var people in appPeople.ToList()) { peopleList.PeopleList.Add(new PeopleModel { PeopleGUID = people.PeopleGUID.ToString(), PlaceGUID = people.PlaceGUID.ToString(), CompanyName = people.CompanyName, BusinessPhone = people.BusinessPhone, MarketGUID = people.MarketGUID.ToString(), FirstName = people.FirstName, LastName = people.LastName, UserGUID = people.UserGUID.ToString(), OrganizationGUID = people.OrganizationGUID.ToString(), MobilePhone = people.MobilePhone, HomePhone = people.HomePhone, Emails = people.Emails, AddressLine1 = people.AddressLine1, AddressLine2 = people.AddressLine2, City = people.City, State = people.State, Country = people.Country, ZipCode = people.ZipCode, StoreID = getStoreID(people.PeopleGUID.ToString()) }); } } var viewModel = new PeopleViewModel(); // viewModel.Place = placeList.PlaceList.AsEnumerable(); viewModel.People = peopleList.PeopleList.AsEnumerable(); pcustomerview.PeopleViewModel = viewModel; #endregion #region Customer Stop Details var marketList = new MarketViewModel(); marketList.MarketList = new List<MarketModel>(); var appMarket = new List<Market>(); if (!string.IsNullOrEmpty(regionguid)) { TempData["TabName"] = "Stores"; appMarket = _IMarketRepository.GetMarketByOwnerandRegionGUID(new Guid(regionguid), new Guid(customerid), 1).ToList(); } else { appMarket = _IMarketRepository.GetMarketByOwnerGUID(new Guid(customerid)).ToList(); } if (appMarket != null && appMarket.Count > 0) { ViewBag.Store_Search = Store_Search; if (!string.IsNullOrEmpty(Store_Search)) { Store_Search = Store_Search.ToLower(); appMarket = appMarket.Where( p => (!String.IsNullOrEmpty(p.MarketName) && p.MarketName.ToLower().StartsWith(Store_Search)) || (!String.IsNullOrEmpty(p.MarketID) && p.MarketID.ToLower().StartsWith(Store_Search)) || (!String.IsNullOrEmpty(_IUserProfileRepository.GetUserProfileByUserID(new Guid(p.UserGUID.ToString()), new Guid(p.OrganizationGUID.ToString())).FirstName) && (_IUserProfileRepository.GetUserProfileByUserID(new Guid(p.UserGUID.ToString()), new Guid(p.OrganizationGUID.ToString())).FirstName).ToLower().Contains(Store_Search)) || (!String.IsNullOrEmpty(p.MarketPhone) && p.MarketPhone.ToLower().StartsWith(Store_Search)) || (!String.IsNullOrEmpty(p.Emails) && p.Emails.ToLower().StartsWith(Store_Search))).ToList(); } store_TotalRecord = appMarket.ToList().Count; store_TotalPage = (store_TotalRecord / (int)ViewBag.pageStoreCountValue) + ((store_TotalRecord % (int)ViewBag.pageStoreCountValue) > 0 ? 1 : 0); ViewBag.Store_TotalRows = store_TotalRecord; appMarket = appMarket.OrderBy(a => a.OrganizationGUID).Skip(((page - 1) * (int)ViewBag.pageStoreCountValue)).Take((int)ViewBag.pageStoreCountValue).ToList(); foreach (var market in appMarket.ToList()) { MarketModel MarketModel = new MarketModel(); MarketModel.MarketID = market.MarketID; MarketModel.MarketGUID = market.MarketGUID.ToString(); MarketModel.UserGUID = market.UserGUID != null ? market.UserGUID.ToString() : Guid.Empty.ToString(); MarketModel.OrganizationGUID = market.OrganizationGUID != null ? market.OrganizationGUID.ToString() : Guid.Empty.ToString(); MarketModel.OwnerGUID = market.OwnerGUID != null ? market.OwnerGUID.ToString() : Guid.Empty.ToString(); MarketModel.MarketName = market.MarketName; MarketModel.MarketPhone = market.MarketPhone; MarketModel.PrimaryContactGUID = market.PrimaryContactGUID != null ? market.PrimaryContactGUID.ToString() : Guid.Empty.ToString(); MarketModel.FirstName = market.FirstName; if (!string.IsNullOrEmpty(market.RMUserID)) { GlobalUser _globalUser = _IGlobalUserRepository.GetGlobalUserByUserID(market.RMUserID, Session["OrganizationGUID"].ToString()); if (_globalUser != null) { UserProfile _userprofile = _IUserProfileRepository.GetUserProfileByUserID(_globalUser.UserGUID, new Guid(MarketModel.OrganizationGUID)); if (_userprofile != null) { MarketModel.RMName = _userprofile.FirstName + " " + _userprofile.LastName; } else { MarketModel.RMName = ""; } } } MarketModel.LastName = market.LastName; MarketModel.MobilePhone = market.MobilePhone; MarketModel.HomePhone = market.HomePhone; MarketModel.Emails = market.Emails; MarketModel.AddressLine1 = market.AddressLine1; MarketModel.AddressLine2 = market.AddressLine2; MarketModel.City = market.City; MarketModel.State = market.State; MarketModel.Country = market.Country; MarketModel.ZipCode = market.ZipCode; MarketModel.RegionGUID = market.RegionGUID != null ? market.RegionGUID.ToString() : Guid.Empty.ToString(); MarketModel.TerritoryGUID = market.TerritoryGUID != null ? market.TerritoryGUID.ToString() : Guid.Empty.ToString(); MarketModel.RegionName = market.RegionGUID != null ? _IRegionRepository.GetRegionNameByRegionGUID(new Guid(market.RegionGUID.ToString())) : ""; MarketModel.TerritoryName = market.TerritoryGUID != null ? _ITerritoryRepository.GetTerritoryNameByTerritoryGUID(new Guid(market.TerritoryGUID.ToString())) : ""; marketList.MarketList.Add(MarketModel); } } var mviewModel = new MarketViewModel(); // mviewModel.Place = placeList.PlaceList.AsEnumerable(); mviewModel.Market = marketList.MarketList.AsEnumerable(); pcustomerview.MarketViewModel = mviewModel; #endregion #region Customer Edit PlaceModel lplace = new PlaceModel(); lplace.PlaceGUID = customerid; Place Place = _IPlaceRepository.GetPlaceByID(new Guid(lplace.PlaceGUID)); if (Place != null) { lplace.PlaceGUID = Place.PlaceGUID.ToString(); lplace.PlaceID = Place.PlaceID; lplace.UserGUID = Place.UserGUID.ToString(); lplace.OrganizationGUID = Place.OrganizationGUID != null ? Place.OrganizationGUID.ToString() : Guid.Empty.ToString(); lplace.PlaceName = Place.PlaceName; lplace.FirstName = Place.FirstName; lplace.LastName = Place.LastName; lplace.MobilePhone = Place.MobilePhone; lplace.PlacePhone = Place.PlacePhone; lplace.HomePhone = Place.HomePhone; lplace.Emails = Place.Emails; lplace.AddressLine1 = Place.AddressLine1; lplace.AddressLine2 = Place.AddressLine2; lplace.City = Place.City; lplace.State = Place.State; lplace.Country = Place.Country; lplace.ZipCode = Place.ZipCode; Session["PlaceName"] = Place.PlaceName; pcustomerview.PlaceModel = lplace; ViewBag.ClientID = lplace.PlaceGUID.ToString(); //UserProfile _userProfile = _IUserProfileRepository.GetUserProfileByUserID(Place.UserGUID); //if (_userProfile != null) //{ // pcustomerview.ManagerName = _userProfile.FirstName + " " + _userProfile.LastName; //} //else //{ // pcustomerview.ManagerName = ""; //} } #endregion if (!string.IsNullOrEmpty(Contact_RowCount)) ViewBag.pageContactCountValue = int.Parse(Contact_RowCount); else ViewBag.pageContactCountValue = 5; if (!string.IsNullOrEmpty(Store_RowCount)) ViewBag.pageStoreCountValue = int.Parse(Store_RowCount); else ViewBag.pageStoreCountValue = 5; bool contact = false; bool store = false; if (null != Request && System.Text.RegularExpressions.Regex.IsMatch(Request.Url.ToString(), string.Format(@"\b{0}\b", "Contacts"))) contact = true; if (null != Request && System.Text.RegularExpressions.Regex.IsMatch(Request.Url.ToString(), string.Format(@"\b{0}\b", "Stores"))) store = true; if (contact) TempData["TabName"] = "Contacts"; else if (store) TempData["TabName"] = "Stores"; } return View(pcustomerview); } else { return RedirectToAction("SessionTimeOut", "User"); } } catch (Exception ex) { Logger.Error(ex.Message); return RedirectToAction("Login", "User"); } }
public ActionResult Edit(string id = "", string jobindexguid = "") { Logger.Debug("Inside People Controller- Create"); try { if (Session["OrganizationGUID"] != null) { DropdownValues(); Job _job = _IJobRepository.GetJobByID(new Guid(jobindexguid)); JobModel job = new JobModel(); job.JobIndexGUID = _job.JobGUID; // job.JobLogicalID = _IJobSchemaRepository.GetJobFormIDfromJobForm(_job.JobForm.ToString()); job.JobReferenceNo = _job.JobReferenceNo; job.JobName = _job.JobName; job.CustGUID = _job.CustomerGUID != null ? new Guid(_job.CustomerGUID.ToString()) : Guid.Empty; job.IsScheduled = _job.IsSecheduled == true ? "true" : "false"; double duration; if (double.TryParse(_job.EstimatedDuration.ToString(), out duration)) job.EstimatedDuration = duration / 3600; else job.EstimatedDuration = 0; job.PreferredStartTime = Convert.ToDateTime(_job.PreferedStartTime).ToString("yy/MM/dd HH:mm"); job.PreferredEndTime = Convert.ToDateTime(_job.PreferedEndTime).ToString("yy/MM/dd HH:mm"); job.RegionCode = _job.RegionGUID != null ? new Guid(_job.RegionGUID.ToString()) : Guid.Empty; job.TerritoryCode = _job.TerritoryGUID != null ? new Guid(_job.TerritoryGUID.ToString()) : Guid.Empty; job.StopsGUID = _job.CustomerStopGUID != null ? new Guid(_job.CustomerStopGUID.ToString()) : Guid.Empty; job.CustomerName = job.CustGUID != Guid.Empty ? _IJobRepository.GetCustomerName(job.CustGUID) : ""; job.CreateDate = _job.CreateDate; var placeList = new PlaceViewModel(); placeList.PlaceList = new List<PlaceModel>(); var appPlace = new List<Place>(); appPlace = _IPlaceRepository.GetPlaceByOrganizationGUID(new Guid(Session["OrganizationGUID"].ToString())).ToList(); placeList.PlaceList.Add(new PlaceModel { PlaceGUID = Guid.Empty.ToString(), PlaceName = "All", UserGUID = "", OrganizationGUID = "", }); foreach (var place in appPlace.ToList()) { placeList.PlaceList.Add(new PlaceModel { PlaceGUID = place.PlaceGUID.ToString(), PlaceID = place.PlaceID, PlaceName = place.PlaceName, UserGUID = place.UserGUID.ToString(), OrganizationGUID = place.OrganizationGUID != null ? place.OrganizationGUID.ToString() : Guid.Empty.ToString(), }); } var marketList = new MarketViewModel(); marketList.MarketList = new List<MarketModel>(); var appMarket = new List<Market>(); if (string.IsNullOrEmpty(id) || Guid.Empty == new Guid(id)) { // if (Session["UserType"].ToString() == "ENT_A") { appMarket = _IMarketRepository.GetMarketByOrganizationGUID(new Guid(Session["OrganizationGUID"].ToString()), 1).ToList(); } //else //{ // appMarket = _IMarketRepository.GetMarketByUserGUID(new Guid(Session["UserGUID"].ToString()), 1).ToList(); //} if (!string.IsNullOrEmpty(id) && Guid.Empty == new Guid(id)) ViewBag.PlaceGUID = Guid.Empty.ToString(); } else { appMarket = _IMarketRepository.GetMarketByOwnerGUID(new Guid(id)).ToList(); ViewBag.PlaceGUID = id; } foreach (var market in appMarket.ToList()) { marketList.MarketList.Add(new MarketModel { MarketGUID = market.MarketGUID.ToString(), MarketID = market.MarketID, UserGUID = market.UserGUID != null ? market.UserGUID.ToString() : Guid.Empty.ToString(), OrganizationGUID = market.OrganizationGUID != null ? market.OrganizationGUID.ToString() : Guid.Empty.ToString(), OwnerGUID = market.OwnerGUID != null ? market.OwnerGUID.ToString() : Guid.Empty.ToString(), MarketName = market.MarketName, MarketPhone = market.MarketPhone, PrimaryContactGUID = market.PrimaryContactGUID != null ? market.PrimaryContactGUID.ToString() : Guid.Empty.ToString(), FirstName = market.FirstName, LastName = market.LastName, MobilePhone = market.MobilePhone, HomePhone = market.HomePhone, Emails = market.Emails, AddressLine1 = market.AddressLine1, AddressLine2 = market.AddressLine2, City = market.City, State = market.State, Country = market.Country, ZipCode = market.ZipCode, RegionGUID = market.RegionGUID != null ? market.RegionGUID.ToString() : Guid.Empty.ToString(), TerritoryGUID = market.TerritoryGUID != null ? market.TerritoryGUID.ToString() : Guid.Empty.ToString(), RegionName = market.RegionGUID != null ? _IRegionRepository.GetRegionNameByRegionGUID(new Guid(market.RegionGUID.ToString())) : "", TerritoryName = market.TerritoryGUID != null ? _ITerritoryRepository.GetTerritoryNameByTerritoryGUID(new Guid(market.TerritoryGUID.ToString())) : "", }); } var viewModel = new JobViewModel(); viewModel.Place = placeList.PlaceList; viewModel.Market = marketList.MarketList; viewModel.JobModel = job; return View(viewModel); } else { return RedirectToAction("SessionTimeOut", "User"); } } catch (Exception ex) { Logger.Error(ex.Message); return RedirectToAction("Login", "User"); } }
public ActionResult Create(string id = "") { Logger.Debug("Inside People Controller- Create"); try { if (Session["OrganizationGUID"] != null) { var placeList = new PlaceViewModel(); placeList.PlaceList = new List<PlaceModel>(); var appPlace = new List<Place>(); DropdownValues(); appPlace = _IPlaceRepository.GetPlaceByOrganizationGUID(new Guid(Session["OrganizationGUID"].ToString())).ToList(); placeList.PlaceList.Add(new PlaceModel { PlaceGUID = Guid.Empty.ToString(), PlaceName = "All", UserGUID = "", OrganizationGUID = "", }); foreach (var place in appPlace.ToList()) { placeList.PlaceList.Add(new PlaceModel { PlaceGUID = place.PlaceGUID.ToString(), PlaceID = place.PlaceID, PlaceName = place.PlaceName, UserGUID = place.UserGUID.ToString(), OrganizationGUID = place.OrganizationGUID != null ? place.OrganizationGUID.ToString() : Guid.Empty.ToString(), }); } var marketList = new MarketViewModel(); marketList.MarketList = new List<MarketModel>(); var appMarket = new List<Market>(); if (string.IsNullOrEmpty(id) || Guid.Empty == new Guid(id)) { // if (Session["UserType"].ToString() == "ENT_A") { appMarket = _IMarketRepository.GetMarketByOrganizationGUID(new Guid(Session["OrganizationGUID"].ToString()), 1).ToList(); } //else //{ // appMarket = _IMarketRepository.GetMarketByUserGUID(new Guid(Session["UserGUID"].ToString()), 1).ToList(); //} if (!string.IsNullOrEmpty(id) && Guid.Empty == new Guid(id)) ViewBag.PlaceGUID = Guid.Empty.ToString(); } else { appMarket = _IMarketRepository.GetMarketByOwnerGUID(new Guid(id)).ToList(); ViewBag.PlaceGUID = id; } foreach (var market in appMarket.ToList()) { marketList.MarketList.Add(new MarketModel { MarketGUID = market.MarketGUID.ToString(), MarketID = market.MarketID, UserGUID = market.UserGUID != null ? market.UserGUID.ToString() : Guid.Empty.ToString(), OrganizationGUID = market.OrganizationGUID != null ? market.OrganizationGUID.ToString() : Guid.Empty.ToString(), OwnerGUID = market.OwnerGUID != null ? market.OwnerGUID.ToString() : Guid.Empty.ToString(), MarketName = market.MarketName, MarketPhone = market.MarketPhone, PrimaryContactGUID = market.PrimaryContactGUID != null ? market.PrimaryContactGUID.ToString() : Guid.Empty.ToString(), FirstName = market.FirstName, LastName = market.LastName, MobilePhone = market.MobilePhone, HomePhone = market.HomePhone, Emails = market.Emails, AddressLine1 = market.AddressLine1, AddressLine2 = market.AddressLine2, City = market.City, State = market.State, Country = market.Country, ZipCode = market.ZipCode, RegionGUID = market.RegionGUID != null ? market.RegionGUID.ToString() : Guid.Empty.ToString(), TerritoryGUID = market.TerritoryGUID != null ? market.TerritoryGUID.ToString() : Guid.Empty.ToString(), RegionName = market.RegionGUID != null ? _IRegionRepository.GetRegionNameByRegionGUID(new Guid(market.RegionGUID.ToString())) : "", TerritoryName = market.TerritoryGUID != null ? _ITerritoryRepository.GetTerritoryNameByTerritoryGUID(new Guid(market.TerritoryGUID.ToString())) : "", }); } var viewModel = new JobViewModel(); viewModel.Place = placeList.PlaceList; viewModel.Market = marketList.MarketList; if (TempData["JobItem"] != null) { viewModel.JobModel = (JobModel)TempData["JobItem"]; } return View(viewModel); } else { return RedirectToAction("SessionTimeOut", "User"); } } catch (Exception ex) { Logger.Error(ex.Message); return RedirectToAction("Login", "User"); } }