private void AddWarehouse(ref OperationResult pobjOperationResult, List <nodeorganizationlocationwarehouseprofileDto> pobjWarehouseList, List <string> ClientSession) { try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); nodeorganizationlocationwarehouseprofile objnodeorganizationlocationwarehouseprofile = null; // Grabar almacén foreach (var item in pobjWarehouseList) { var objEntitySource = (from a in dbContext.nodeorganizationlocationwarehouseprofile where a.i_NodeId == item.i_NodeId && a.v_OrganizationId == item.v_OrganizationId && a.v_LocationId == item.v_LocationId && a.v_WarehouseId == item.v_WarehouseId select a).FirstOrDefault(); if (objEntitySource != null) { objEntitySource.d_UpdateDate = DateTime.Now; objEntitySource.i_UpdateUserId = Int32.Parse(ClientSession[2]); objEntitySource.i_IsDeleted = 0; // Guardar los cambios dbContext.SaveChanges(); } else { objnodeorganizationlocationwarehouseprofile = nodeorganizationlocationwarehouseprofileAssembler.ToEntity(item); objnodeorganizationlocationwarehouseprofile.d_InsertDate = DateTime.Now; objnodeorganizationlocationwarehouseprofile.i_InsertUserId = int.Parse(ClientSession[2]); objnodeorganizationlocationwarehouseprofile.i_IsDeleted = 0; dbContext.AddTonodeorganizationlocationwarehouseprofile(objnodeorganizationlocationwarehouseprofile); dbContext.SaveChanges(); } } pobjOperationResult.Success = 1; // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "", "", Success.Ok, null); return; } 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, "", "", Success.Failed, pobjOperationResult.ExceptionMessage); return; } }
/// <summary> /// Converts this instance of <see cref="nodeorganizationlocationwarehouseprofile"/> to an instance of <see cref="nodeorganizationlocationwarehouseprofileDto"/>. /// </summary> /// <param name="entity"><see cref="nodeorganizationlocationwarehouseprofile"/> to convert.</param> public static nodeorganizationlocationwarehouseprofileDto ToDTO(this nodeorganizationlocationwarehouseprofile entity) { if (entity == null) { return(null); } var dto = new nodeorganizationlocationwarehouseprofileDto(); dto.i_NodeId = entity.i_NodeId; dto.v_OrganizationId = entity.v_OrganizationId; dto.v_LocationId = entity.v_LocationId; dto.v_WarehouseId = entity.v_WarehouseId; 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="nodeorganizationlocationwarehouseprofileDto"/> to an instance of <see cref="nodeorganizationlocationwarehouseprofile"/>. /// </summary> /// <param name="dto"><see cref="nodeorganizationlocationwarehouseprofileDto"/> to convert.</param> public static nodeorganizationlocationwarehouseprofile ToEntity(this nodeorganizationlocationwarehouseprofileDto dto) { if (dto == null) { return(null); } var entity = new nodeorganizationlocationwarehouseprofile(); entity.i_NodeId = dto.i_NodeId; entity.v_OrganizationId = dto.v_OrganizationId; entity.v_LocationId = dto.v_LocationId; entity.v_WarehouseId = dto.v_WarehouseId; 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); }
/// <summary> /// Invoked when <see cref="ToEntity"/> operation is about to return. /// </summary> /// <param name="entity"><see cref="nodeorganizationlocationwarehouseprofile"/> converted from <see cref="nodeorganizationlocationwarehouseprofileDto"/>.</param> static partial void OnEntity(this nodeorganizationlocationwarehouseprofileDto dto, nodeorganizationlocationwarehouseprofile entity);
/// <summary> /// Invoked when <see cref="ToDTO"/> operation is about to return. /// </summary> /// <param name="dto"><see cref="nodeorganizationlocationwarehouseprofileDto"/> converted from <see cref="nodeorganizationlocationwarehouseprofile"/>.</param> static partial void OnDTO(this nodeorganizationlocationwarehouseprofile entity, nodeorganizationlocationwarehouseprofileDto dto);