public ActionResult GetLocNotIntblLocation(string PipelineDuns) { // This method gets locations that are present in Oacy and Unsc but are not present in location LocationListDTO model = new LocationListDTO(); // var Pipelineduns = _pipelineService.GetDunsByPipelineID(PipelineDuns); if (!string.IsNullOrEmpty(PipelineDuns)) { var request = new RestRequest(string.Format("AddLocsNotInTblLoc"), Method.POST) { RequestFormat = DataFormat.Json }; request.JsonSerializer = NewtonsoftJsonSerializer.Default; request.AddJsonBody(PipelineDuns); var response = clientLocation.Execute <LocationsResultDTO>(request); int totalRecord = 0; if (response.Data != null) { model.LocationsList = response.Data.locationsDTO; totalRecord = response.Data.RecordCount; } else { model.LocationsList = new List <LocationsDTO>(); } } return(Json(new { data = model.LocationsList }, JsonRequestBehavior.AllowGet)); }
public ActionResult AddLocation(FormCollection fc, LocationListDTO locList) { LocationsDTO locationsDTO = new LocationsDTO(); List <LocationsDTO> loc = new List <LocationsDTO>(); string pipelineDuns = fc["PipelineDuns"]; loc = locList.LocationsList.ToList(); locList.DunsNo = pipelineDuns; ILocationService.AddLocationByPipeline(loc, pipelineDuns); return(RedirectToAction("Index", new { pipelineDuns = pipelineDuns })); }
/// <summary> /// Returns a list of location dimensions /// </summary> /// <param name="Page"></param> /// <param name="PageSize"></param> public LocationListDTO GetLocationDimensions(int Page, int PageSize) { try { LocationListDTO list = DimensionDAL.GetLocationDimensions(Page, PageSize); return(list); } catch (Exception) { throw; } }
public PartialViewResult AddLocationRow(string pipelineDuns, string RowCount) { LocationListDTO model = new LocationListDTO(); model.CurrentLocationRow = Convert.ToInt32(RowCount); model.DunsNo = pipelineDuns; model.LocationsList = new List <LocationsDTO>(); var item = new LocationsDTO(); item.CreatedDate = DateTime.Now; model.LocationsList.Add(item); return(PartialView("_AddLocationRow", model)); }
public ActionResult AddLocation(FormCollection fc, LocationListDTO locList) { LocationsDTO locationsDTO = new LocationsDTO(); List <LocationsDTO> loc = new List <LocationsDTO>(); string PipelineDuns = fc["hdnPipelineDuns"]; loc = locList.LocationsList.ToList(); var request = new RestRequest(string.Format("AddLocation"), Method.POST) { RequestFormat = DataFormat.Json }; request.JsonSerializer = NewtonsoftJsonSerializer.Default; request.AddJsonBody(loc); var response = clientLocation.Execute <bool>(request); string pipeline = loc.Select(x => x.PipelineDuns).ToString(); return(RedirectToAction("Index", new { pipelineDuns = pipeline })); }
/// <summary> /// Returns a list of locations from the database /// </summary> /// <returns></returns> public LocationListDTO GetLocationDimensions(int Page, int PageSize) { LocationListDTO list = new LocationListDTO(); SQLAzure.DbConnection dbConn = new SQLAzure.DbConnection(_connectionString); try { dbConn.Open(); SQLAzure.RetryLogic.DbCommand dbComm = new SQLAzure.RetryLogic.DbCommand(dbConn); dbComm.CommandText = String.Format("SELECT ID, LocationID, LocationNumber, TotalCount = COUNT(ID) OVER() FROM DimLocation ORDER BY ID OFFSET {0} ROWS FETCH NEXT {1} ROWS ONLY", (Page * PageSize), PageSize); System.Data.IDataReader rdr = dbComm.ExecuteReader(System.Data.CommandType.Text); while (rdr.Read()) { LocationDTO location = new LocationDTO(); location.ID = Convert.ToInt32(rdr["ID"]); location.LocationID = Guid.Parse(rdr["LocationID"].ToString()); location.LocationNumber = Convert.ToInt32(rdr["LocationNumber"].ToString()); list.Items.Add(location); list.RecordCount = Convert.ToInt32(rdr["TotalCount"]); } list.PageNumber = Page; list.PageSize = PageSize; list.TotalPages = GetNumberOfPagesAvailable(PageSize, list.RecordCount); } catch (SqlException) { throw; } finally { dbConn.Close(); } return(list); }
public IHttpActionResult Get(int Page, int PageSize) { ValidateModel(); try { LocationListDTO list = _dimensionBLL.GetLocationDimensions(Page, PageSize); LocationDimensionList locationDimensions = new LocationDimensionList(); foreach (LocationDTO l in list.Items) { locationDimensions.Items.Add((LocationDimension)l); } if (locationDimensions.Items.Count > 0) { locationDimensions.PageNumber = list.PageNumber; locationDimensions.PageSize = list.PageSize; locationDimensions.RecordCount = list.RecordCount; locationDimensions.TotalPages = list.TotalPages; return(Ok(locationDimensions)); } else { HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.NoContent); response.Content = new StringContent("No Content"); return(ResponseMessage(response)); } } catch (Exception ex) { HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.InternalServerError); response.Content = new StringContent("Unknown Error"); // Insert Logging here Console.WriteLine(ex); return(ResponseMessage(response)); } }
public ActionResult GetLocNotIntblLocation(string PipelineDuns) { // This method gets locations that are present in Oacy and Unsc but are not present in location LocationListDTO model = new LocationListDTO(); if (!string.IsNullOrEmpty(PipelineDuns)) { var result = ILocationService.AddLocsNotInTblLoc(PipelineDuns); int totalRecord = 0; if (result != null) { model.LocationsList = result.locationsDTO; totalRecord = result.RecordCount; } else { model.LocationsList = new List <LocationsDTO>(); } } return(Json(new { data = model.LocationsList }, JsonRequestBehavior.AllowGet)); }
public ActionResult GetData(string pipelineDuns) { LocationListDTO model = new LocationListDTO(); //int pipeId = pipelineId.GetValueOrDefault(); ShipperReturnByIdentity currentIdentityValues = GetValueFromIdentity(); //if (pipelineId == null) // pipelineId = currentIdentityValues.FirstSelectedPipeIdByUser; model.DunsNo = pipelineDuns; if (!string.IsNullOrEmpty(pipelineDuns)) { var request = new RestRequest(string.Format("GetPipelineLocation"), Method.POST) { RequestFormat = DataFormat.Json }; request.JsonSerializer = NewtonsoftJsonSerializer.Default; request.AddJsonBody(pipelineDuns); var response = clientLocation.Execute <LocationsResultDTO>(request); int totalRecords = 0; if (response.Data != null) { model.LocationsList = response.Data.locationsDTO; totalRecords = response.Data.RecordCount; } else { model.LocationsList = new List <LocationsDTO>(); totalRecords = 0; } // Filter record count. int recFilter = totalRecords; } return(Json(new { data = model.LocationsList }, JsonRequestBehavior.AllowGet)); }