public JsonResult UpdateGuia([FromBody] GuiaTransporteNavViewModel data) { //if (data.NifCliente != "" && (data.VATRegistrationNo == null || data.VATRegistrationNo == "")) // data.VATRegistrationNo = data.NifCliente; data.CastDateTimeStringPropertiesToDateTime(); bool result = DBNAV2017GuiasTransporte.UpdateGuiaTransporte(data); return(Json(result)); }
public JsonResult CopyRequsitionLines([FromBody] JObject requestParams) { string noGuia = requestParams["noGuia"] == null ? "" : (string)requestParams["noGuia"]; string requisitionNo = requestParams["requisitionNo"] == null ? "" : (string)requestParams["requisitionNo"]; int lastLineNo = requestParams["lastLineNo"] == null ? 0 : (int)requestParams["lastLineNo"]; if (noGuia == "" || requisitionNo == "") { return(Json(false)); } bool result = DBNAV2017GuiasTransporte.CreateLinhasFromRequisitionNo(noGuia, requisitionNo, lastLineNo); return(Json(result)); }
public JsonResult UpdateShipmentLine([FromBody] LinhaGuiaTransporteNavViewModel line) { if (line.NoGuiaTransporte == "" || line.NoGuiaTransporte == null) { return(Json(false)); } if (line.NoLinha == 0) { return(Json(false)); } bool result = DBNAV2017GuiasTransporte.UpdateLinhaGuiaTransporte(line); return(Json(result)); }
public JsonResult GetListGuiasTransporteNav([FromBody] JObject requestParams) { bool historic = requestParams["Historic"] == null ? false : bool.Parse(requestParams["Historic"].ToString()); List <AcessosDimensões> userDimensions = DBUserDimensions.GetByUserId(User.Identity.Name); List <GuiaTransporteNavViewModel> result = DBNAV2017GuiasTransporte.GetListByDim(_config.NAVDatabaseName, _config.NAVCompanyName, userDimensions, historic); if (historic) { ViewBag.Historic = "(Histórico) "; ViewBag.ifHistoric = true; } else { ViewBag.Historic = " "; ViewBag.ifHistoric = false; } return(Json(result)); }
public JsonResult GetThirdPartiesList([FromBody] JObject requestParams) { if (requestParams == null) { return(Json(null)); } int type = (requestParams["type"] == null || string.Compare((string)requestParams["type"], "") == 0) ? -1 : (int)requestParams["type"]; if (type == -1) { return(Json(null)); } List <ThirdPartyViewModel> result = DBNAV2017GuiasTransporte.GetThirdParties(_config.NAVDatabaseName, _config.NAVCompanyName, type); return(Json(result)); }
public JsonResult GetShipItems([FromBody] JObject requestParams) { if (requestParams == null) { return(Json(null)); } int itemType = (requestParams["itemType"] == null || string.Compare((string)requestParams["itemType"], "") == 0) ? -1 : (int)requestParams["itemType"]; string itemCode = requestParams["itemCode"] == null ? "-1" : (string)requestParams["itemCode"]; if (itemType == -1) { return(Json(null)); } List <ShipmentLineItem> items = DBNAV2017GuiasTransporte.GetShipmentItems(_config.NAVDatabaseName, _config.NAVCompanyName, itemType, itemCode); return(Json(items)); }
public JsonResult CreateShipmentLine([FromBody] JObject data) { if (data == null) { return(Json(false)); } try { LinhaGuiaTransporteNavViewModel linhaGT = new LinhaGuiaTransporteNavViewModel() { NoGuiaTransporte = (string)data["noGuiaTransporte"], NoLinha = (int)data["noLinha"], Tipo = (int)data["tipo"], No = (string)data["no"], Descricao = (string)data["descricao"], CodUnidadeMedida = (string)data["codUnidadeMedida"], Quantidade = (decimal)data["quantidade"], QuantidadeEnviar = (decimal)data["quantidadeEnviar"], NoProjecto = data["noProjecto"] == null ? "" : (string)data["noProjecto"], UnitCost = (data["unitCost"] == null || string.Compare((string)data["unitCost"], "") == 0) ? 0 : (decimal)data["unitCost"], UnitPrice = (data["unitPrice"] == null || string.Compare((string)data["unitPrice"], "") == 0) ? 0 : (decimal)data["unitPrice"], ShortcutDimension1Code = data["shortcutDimension1code"] == null ? "" : (string)data["shortcutDimension1code"], ShortcutDimension2Code = data["shortcutDimension2Code"] == null ? "" : (string)data["shortcutDimension2Code"], NoCliente = data["noCliente"] == null ? "" : (string)data["noCliente"], DataGuia = (data["dataGuia"] == null || string.Compare((string)data["dataGuia"], "") == 0) ? DateTime.Parse("1900-01-01") : (DateTime)data["dataGuia"], DataEntrega = (data["dataEntrega"] == null || string.Compare((string)data["dataEntrega"], "") == 0) ? DateTime.Parse("1900-01-01") : (DateTime)data["dataEntrega"], TipoTerceiro = data["tipoTerceiro"] == null ? 0 : (int)data["tipoTerceiro"] }; linhaGT.TotalCost = linhaGT.UnitCost * linhaGT.Quantidade; linhaGT.TotalPrice = linhaGT.UnitPrice * linhaGT.Quantidade; bool result = DBNAV2017GuiasTransporte.CreateLinhasGuiaTransporte(linhaGT); return(Json(result)); } catch (Exception ex) { return(Json(false)); } }
public JsonResult DeleteShipmentLine([FromBody] JObject line) { if (line == null) { return(Json(false)); } string noGuia = (line["noGuia"] == null || string.Compare((string)line["noGuia"], "") == 0) ? "" : (string)line["noGuia"]; // When noLinha = 0 we are deleting all document lines int noLinha = (line["noLinha"] == null || string.Compare((string)line["noLinha"], "") == 0) ? 0 : (int)line["noLinha"]; if (noGuia == "") { return(Json(false)); } bool result = DBNAV2017GuiasTransporte.DeleteLinhaGuiaTransporte(_config.NAVDatabaseName, _config.NAVCompanyName, noGuia, noLinha); return(Json(result)); }
public JsonResult GetShipToAddr([FromBody] JObject requestParams) { if (requestParams == null) { return(Json(null)); } string custId = requestParams["customerId"] == null ? "" : (string)requestParams["customerId"]; string shipCode = requestParams["shipToCode"] == null ? "-1" : (string)requestParams["shipToCode"]; if (shipCode == null) { shipCode = "-1"; } if (custId == "") { return(Json(null)); } List <GuiaTransporteShipToAddress> customerAddresses = DBNAV2017GuiasTransporte.GetShipToAddresses(_config.NAVDatabaseName, _config.NAVCompanyName, custId, shipCode); return(Json(customerAddresses)); }
public JsonResult GetThirdPartyDetails([FromBody] JObject requestParams) { if (requestParams == null) { return(Json(null)); } int type = (requestParams["type"] == null || string.Compare((string)requestParams["type"], "") == 0) ? -1 : (int)requestParams["type"]; string entityId = requestParams["entityId"] == null ? "" : (string)requestParams["entityId"]; if (type == -1) { return(Json(null)); } if (entityId == "") { return(Json(null)); } ThirdPartyViewModel result = DBNAV2017GuiasTransporte.GetThirdPartyDetails(_config.NAVDatabaseName, _config.NAVCompanyName, type, entityId); return(Json(result)); }
public JsonResult GetDetailsGuia([FromBody] JObject requestParams) { string noGuia = requestParams["No"] == null ? "" : requestParams["No"].ToString(); bool historic = requestParams["Historic"] == null ? false : bool.Parse(requestParams["Historic"].ToString()); List <AcessosDimensões> userDimensions = DBUserDimensions.GetByUserId(User.Identity.Name); if (noGuia != null) { GuiaTransporteNavViewModel guia = DBNAV2017GuiasTransporte.GetDetailsByNo(_config.NAVDatabaseName, _config.NAVCompanyName, userDimensions, noGuia, historic); if (guia == null) { return(Json(null)); } guia.CastDateTimePropertiesToString(); return(Json(guia)); } else { return(Json(null));; } }
public JsonResult GetPostCodes() { List <NAVPostCode> postCodes = DBNAV2017GuiasTransporte.GetNAVPostCodes(_config.NAVDatabaseName, _config.NAVCompanyName); return(Json(postCodes)); }
public JsonResult GetSourceCodes() { return(Json(DBNAV2017GuiasTransporte.GetShipmentSourceCodes(_config.NAVDatabaseName, _config.NAVCompanyName))); }