/// <summary> /// Converts this instance of <see cref="nodeorganizationlocationprofile"/> to an instance of <see cref="nodeorganizationlocationprofileDto"/>. /// </summary> /// <param name="entity"><see cref="nodeorganizationlocationprofile"/> to convert.</param> public static nodeorganizationlocationprofileDto ToDTO(this nodeorganizationlocationprofile entity) { if (entity == null) { return(null); } var dto = new nodeorganizationlocationprofileDto(); dto.i_NodeId = entity.i_NodeId; dto.v_OrganizationId = entity.v_OrganizationId; dto.v_LocationId = entity.v_LocationId; dto.i_IsDeleted = entity.i_IsDeleted; dto.i_InsertUserId = entity.i_InsertUserId; dto.d_InsertDate = entity.d_InsertDate; dto.i_UpdateUserId = entity.i_UpdateUserId; dto.d_UpdateDate = entity.d_UpdateDate; entity.OnDTO(dto); return(dto); }
/// <summary> /// Converts this instance of <see cref="nodeorganizationlocationprofileDto"/> to an instance of <see cref="nodeorganizationlocationprofile"/>. /// </summary> /// <param name="dto"><see cref="nodeorganizationlocationprofileDto"/> to convert.</param> public static nodeorganizationlocationprofile ToEntity(this nodeorganizationlocationprofileDto dto) { if (dto == null) { return(null); } var entity = new nodeorganizationlocationprofile(); entity.i_NodeId = dto.i_NodeId; entity.v_OrganizationId = dto.v_OrganizationId; entity.v_LocationId = dto.v_LocationId; entity.i_IsDeleted = dto.i_IsDeleted; entity.i_InsertUserId = dto.i_InsertUserId; entity.d_InsertDate = dto.d_InsertDate; entity.i_UpdateUserId = dto.i_UpdateUserId; entity.d_UpdateDate = dto.d_UpdateDate; dto.OnEntity(entity); return(entity); }
public void AddNodeOrganizationLoactionWarehouse(ref OperationResult pobjOperationResult, NodeOrganizationLoactionWarehouseList pobjNodeOrgLocationWarehouse, List <nodeorganizationlocationwarehouseprofileDto> pobjWarehouseList, List <string> ClientSession) { //mon.IsActive = true; nodeorganizationprofile objNodeorganizationprofile = new nodeorganizationprofile(); nodeorganizationlocationprofile objNodeorganizationlocationprofile = new nodeorganizationlocationprofile(); try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); OperationResult objOperationResult5 = new OperationResult(); if (pobjWarehouseList != null) { if (IsWarehouseAssignedToNode(ref objOperationResult5, pobjWarehouseList)) { pobjOperationResult = objOperationResult5; return; } } var objEntitySource = (from a in dbContext.nodeorganizationlocationprofile join c in dbContext.nodeorganizationlocationprofile on a.i_NodeId equals c.i_NodeId where a.i_NodeId == pobjNodeOrgLocationWarehouse.i_NodeId && a.v_OrganizationId == pobjNodeOrgLocationWarehouse.v_OrganizationId && c.v_LocationId == pobjNodeOrgLocationWarehouse.v_LocationId select a).FirstOrDefault(); if (objEntitySource != null) { // Actualizar registro (dar de alta al registro ya existente "no volver a insertar") OperationResult objOperationResult2 = new OperationResult(); UpdateNodeOrganizationChangeStatusAll(ref objOperationResult2, pobjNodeOrgLocationWarehouse.i_NodeId, pobjNodeOrgLocationWarehouse.v_OrganizationId, pobjNodeOrgLocationWarehouse.v_LocationId, 0, ClientSession); pobjOperationResult = objOperationResult2; } else { var query = (from a in dbContext.nodeorganizationlocationprofile where a.i_NodeId == pobjNodeOrgLocationWarehouse.i_NodeId && a.v_OrganizationId == pobjNodeOrgLocationWarehouse.v_OrganizationId select a).FirstOrDefault(); // Grabar nuevo if (query == null) { #region Nodeorganization // Grabar nodo / empresa objNodeorganizationprofile.d_InsertDate = DateTime.Now; objNodeorganizationprofile.i_InsertUserId = Int32.Parse(ClientSession[2]); objNodeorganizationprofile.i_IsDeleted = 0; objNodeorganizationprofile.i_NodeId = pobjNodeOrgLocationWarehouse.i_NodeId; objNodeorganizationprofile.v_OrganizationId = pobjNodeOrgLocationWarehouse.v_OrganizationId; dbContext.AddTonodeorganizationprofile(objNodeorganizationprofile); dbContext.SaveChanges(); #endregion #region Nodeorganizationlocation // Grabar nodo / empresa / sede objNodeorganizationlocationprofile.d_InsertDate = DateTime.Now; objNodeorganizationlocationprofile.i_InsertUserId = Int32.Parse(ClientSession[2]); objNodeorganizationlocationprofile.i_IsDeleted = 0; objNodeorganizationlocationprofile.i_NodeId = pobjNodeOrgLocationWarehouse.i_NodeId; objNodeorganizationlocationprofile.v_OrganizationId = pobjNodeOrgLocationWarehouse.v_OrganizationId; objNodeorganizationlocationprofile.v_LocationId = pobjNodeOrgLocationWarehouse.v_LocationId; dbContext.AddTonodeorganizationlocationprofile(objNodeorganizationlocationprofile); dbContext.SaveChanges(); #endregion #region Add Warehouse // Graba almacenes OperationResult objOperationResult1 = new OperationResult(); if (pobjWarehouseList != null) { AddWarehouse(ref objOperationResult1, pobjWarehouseList, ClientSession); } #endregion } else { #region Nodeorganizationlocation // Grabar nodo / empresa / sede objNodeorganizationlocationprofile.d_InsertDate = DateTime.Now; objNodeorganizationlocationprofile.i_InsertUserId = Int32.Parse(ClientSession[2]); objNodeorganizationlocationprofile.i_IsDeleted = 0; objNodeorganizationlocationprofile.i_NodeId = pobjNodeOrgLocationWarehouse.i_NodeId; objNodeorganizationlocationprofile.v_OrganizationId = pobjNodeOrgLocationWarehouse.v_OrganizationId; objNodeorganizationlocationprofile.v_LocationId = pobjNodeOrgLocationWarehouse.v_LocationId; dbContext.AddTonodeorganizationlocationprofile(objNodeorganizationlocationprofile); dbContext.SaveChanges(); #endregion #region Add Warehouse // Graba almacenes OperationResult objOperationResult1 = new OperationResult(); if (pobjWarehouseList != null) { AddWarehouse(ref objOperationResult1, pobjWarehouseList, ClientSession); } #endregion } } pobjOperationResult.Success = 1; // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "EMPRESA / SEDE / ALMACÉN", "v_OrganizationId=" + objNodeorganizationprofile.v_OrganizationId, Success.Ok, null); } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "EMPRESA / SEDE / ALMACÉN", "v_OrganizationId=" + objNodeorganizationprofile.v_OrganizationId, Success.Failed, pobjOperationResult.ExceptionMessage); } }
/// <summary> /// Invoked when <see cref="ToEntity"/> operation is about to return. /// </summary> /// <param name="entity"><see cref="nodeorganizationlocationprofile"/> converted from <see cref="nodeorganizationlocationprofileDto"/>.</param> static partial void OnEntity(this nodeorganizationlocationprofileDto dto, nodeorganizationlocationprofile entity);
/// <summary> /// Invoked when <see cref="ToDTO"/> operation is about to return. /// </summary> /// <param name="dto"><see cref="nodeorganizationlocationprofileDto"/> converted from <see cref="nodeorganizationlocationprofile"/>.</param> static partial void OnDTO(this nodeorganizationlocationprofile entity, nodeorganizationlocationprofileDto dto);