예제 #1
0
        public string AddOrganization(ref OperationResult pobjOperationResult, organizationDto pobjDtoEntity, List <string> ClientSession)
        {
            //mon.IsActive = true;
            string NewId = "(No generado)";

            try
            {
                SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel();
                organization          objEntity = organizationAssembler.ToEntity(pobjDtoEntity);

                objEntity.d_InsertDate   = DateTime.Now;
                objEntity.i_InsertUserId = Int32.Parse(ClientSession[2]);
                objEntity.i_IsDeleted    = 0;
                // Autogeneramos el Pk de la tabla
                int intNodeId = 9;
                NewId = Common.Utils.GetNewId(intNodeId, Utils.GetNextSecuentialId(intNodeId, 5), "OO");
                objEntity.v_OrganizationId = NewId;


                dbContext.AddToorganization(objEntity);
                dbContext.SaveChanges();

                pobjOperationResult.Success = 1;
                return(NewId);
            }
            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, "ORGANIZACIÓN", "i_OrganizationId=" + NewId.ToString(), Success.Failed, pobjOperationResult.ExceptionMessage);
                return(null);
            }
        }