/// <summary> Adds pObjRecord. </summary> /// <remarks> Ranaya, 08/05/2017. </remarks> /// <param name="pObjRecord"> The Object record to add. </param> /// <returns> An int. </returns> public int Add(ProductRequest pObjRecord) { int lIntResult = 0; //CREAR if (!mObjPermissionsDAO.ExistsSaleOrder(pObjRecord.RequestId)) { lIntResult = mObjProductRequestDAO.Add(pObjRecord); if (lIntResult == 0 && mObjPermissionsDAO.IsRequestPreparedToCreateSaleOrder(pObjRecord.RequestId)) { LogService.WriteSuccess("[ProductRequest CREATED]"); lIntResult = mObjPermissionsDAO.CreateSaleOrder(pObjRecord.RequestId); } } //EDITAR else { pObjRecord.RowCode = mObjPermissionsDAO.GetRowCodeByProduct("[@UG_PE_WS_PRRE]", pObjRecord.RequestId, pObjRecord.ProductId); lIntResult = mObjProductRequestDAO.Update(pObjRecord); if (lIntResult == 0) { LogService.WriteSuccess("[ProductRequest UPDATE]"); lIntResult = mObjPermissionsDAO.UpdateSaleOrder(pObjRecord.RequestId); if (lIntResult == 0) { LogService.WriteSuccess("[ProductRequest SaleOrder UPDATE]"); } } } return(lIntResult); }
/// <summary> Adds pObjRecord. </summary> /// <remarks> Ranaya, 08/05/2017. </remarks> /// <param name="pObjRecord"> The Object record to add. </param> /// <returns> An int. </returns> public int Add(PortRequest pObjRecord) { int lIntResult = 0; //CREAR if (!mObjPermissionsDAO.ExistRequest(pObjRecord.RequestId)) { lIntResult = mObjPortRequestDAO.Add(pObjRecord); if (lIntResult == 0) { LogService.WriteSuccess("[PortRequest CREATED]"); if (mObjPermissionsDAO.IsRequestPreparedToCreateSaleOrder(pObjRecord.RequestId)) { lIntResult = mObjPermissionsDAO.CreateSaleOrder(pObjRecord.RequestId); } } else { LogService.WriteError("[PortRequest NO CREATED]"); } } //EDITAR else { // New portRequest line if (mObjPermissionsDAO.IsPortExist(pObjRecord.RequestId, pObjRecord.PortId, pObjRecord.PortType) == "0") { lIntResult = mObjPortRequestDAO.Add(pObjRecord); if (lIntResult == 0) { LogService.WriteSuccess("[PortRequest UPDATE ADDPORT]"); } } // Update portRequest line else { pObjRecord.RowCode = mObjPermissionsDAO.GetRowCodeByPort(pObjRecord.RequestId, pObjRecord.PortId, pObjRecord.PortType); lIntResult = mObjPortRequestDAO.Update(pObjRecord); if (lIntResult == 0) { LogService.WriteSuccess("[PortRequest UPDATE]"); lIntResult = mObjPermissionsDAO.UpdateSaleOrder(pObjRecord.RequestId); if (lIntResult == 0) { LogService.WriteSuccess("[PortRequest SaleOrder UPDATE]"); } } } } return(lIntResult); }
/// <summary> Adds pObjRecord. </summary> /// <remarks> Ranaya, 08/05/2017. </remarks> /// <param name="pObjRecord"> The Object record to add. </param> /// <returns> An int. </returns> public int Add(DestinationRequest pObjRecord) { int lIntResult = 0; //CREAR if (!mObjPermissionsDAO.ExistRequest(pObjRecord.RequestId)) { lIntResult = mObjDestinationRequestDAO.Add(pObjRecord); if (lIntResult == 0) { LogService.WriteSuccess("[DestinationRequest CREATED]"); if (mObjPermissionsDAO.IsRequestPreparedToCreateSaleOrder(pObjRecord.RequestId)) { lIntResult = mObjPermissionsDAO.CreateSaleOrder(pObjRecord.RequestId); if (lIntResult == 0) { LogService.WriteSuccess("[DestinationRequest SaleOrder CREATED]"); } } } else { LogService.WriteError("[DestinationRequest NO CREATED]"); } } //EDITAR else { try { pObjRecord.RowCode = mObjPermissionsDAO.GetRowCode("[@UG_PE_WS_DERE]", pObjRecord.RequestId); lIntResult = mObjDestinationRequestDAO.Update(pObjRecord); if (lIntResult == 0) { LogService.WriteSuccess("[DestinationRequest UPDATE]"); lIntResult = mObjPermissionsDAO.UpdateSaleOrder(pObjRecord.RequestId); } else { LogService.WriteError("ERROR:[DestinationRequest UPDATE]"); } } catch (Exception ex) { LogService.WriteError("ERROR:[DestinationRequest UPDATE] - " + ex.Message); } } return(lIntResult); }
/// <summary> Adds pObjRecord. </summary> /// <remarks> Ranaya, 08/05/2017. </remarks> /// <param name="pObjRecord"> The Object record to add. </param> /// <returns> An int. </returns> public int Add(ParameterRequest pObjRecord) { int lIntResult = 0; //CREAR if (!mObjPermissionsDAO.ExistRequest(pObjRecord.RequestId)) { lIntResult = mObjParameterRequestDAO.Add(pObjRecord); if (lIntResult == 0) { LogService.WriteSuccess("[ParameterRequest CREATE]"); if (mObjPermissionsDAO.IsRequestPreparedToCreateSaleOrder(pObjRecord.RequestId)) { lIntResult = mObjPermissionsDAO.CreateSaleOrder(pObjRecord.RequestId); } } else { LogService.WriteError("[ParameterRequest NO CREATE]"); } } /* * //EDITAR * else * { * try * { * pObjRecord.RowCode = mObjPermissionsDAO.GetRowCode("[@UG_PE_WS_PARE]", pObjRecord.RequestId); * lIntResult = mObjParameterRequestDAO.Update(pObjRecord); * * if (lIntResult == 0) * { * LogService.WriteSuccess("[ParameterRequest UPDATE]"); * lIntResult = mObjPermissionsDAO.UpdateSaleOrder(pObjRecord.RequestId); * } * else * { * LogService.WriteError("ERROR:[ParameterRequest UPDATE]"); * } * } * catch (Exception ex) * { * LogService.WriteError("ERROR:[ParameterRequest UPDATE] - " + ex.Message); * } * * } */ return(lIntResult); }
/// <summary> Adds pObjRecord. </summary> /// <remarks> Ranaya, 08/05/2017. </remarks> /// <param name="pObjRecord"> The Object record to add. </param> /// <returns> An int. </returns> public int Add(PermissionRequest pObjRecord) { int lIntResult = 0; string lStrPrefix = ""; //CREAR if (!mObjPermissionsDAO.ExistsSaleOrder(pObjRecord.RequestId)) { if (pObjRecord.MobilizationTypeId == 2) { lStrPrefix = "SM"; } else { lStrPrefix = "SX"; } pObjRecord.UgrsRequest = lStrPrefix; LogService.WriteError("[Prefix =" + lStrPrefix + "]"); if (mObjPermissionsDAO.GetNextUgrsFolio(lStrPrefix) == 0) { LogService.WriteError("[ERROR:NextUGRSFolio = 0]"); } else { pObjRecord.UgrsFolio = mObjPermissionsDAO.GetNextUgrsFolio(lStrPrefix); LogService.WriteError("[UGRSFolio =" + pObjRecord.UgrsFolio + "]"); lIntResult = mObjPermissionRequestDAO.Add(pObjRecord); LogService.WriteSuccess("[PermissionRequest CREATE]"); if (lIntResult == 0 && mObjPermissionsDAO.IsRequestPreparedToCreateSaleOrder(pObjRecord.RequestId)) { lIntResult = mObjPermissionsDAO.CreateSaleOrder(pObjRecord.RequestId); } } } //EDITAR else { try { pObjRecord.RowCode = mObjPermissionsDAO.GetRowCode("[@UG_PE_WS_PERE]", pObjRecord.RequestId); pObjRecord.UgrsFolio = mObjPermissionsDAO.GetUgrsFolio(pObjRecord.RequestId); lIntResult = mObjPermissionRequestDAO.Update(pObjRecord); if (lIntResult == 0) { LogService.WriteSuccess("[PermissionRequest UPDATE]"); lIntResult = mObjPermissionsDAO.UpdateSaleOrder(pObjRecord.RequestId); if (lIntResult == 0) { LogService.WriteSuccess("[PermissionRequest SaleOrder UPDATE]"); } } else { LogService.WriteError("ERROR:[PermissionRequest UPDATE]"); } } catch (Exception ex) { LogService.WriteError("ERROR:[PermissionRequest UPDATE] - " + ex.Message); } } return(lIntResult); }