Example #1
0
        /// <summary>
        /// Converts this instance of <see cref="problemaDto"/> to an instance of <see cref="problema"/>.
        /// </summary>
        /// <param name="dto"><see cref="problemaDto"/> to convert.</param>
        public static problema ToEntity(this problemaDto dto)
        {
            if (dto == null)
            {
                return(null);
            }

            var entity = new problema();

            entity.v_ProblemaId      = dto.v_ProblemaId;
            entity.i_Tipo            = dto.i_Tipo;
            entity.v_PersonId        = dto.v_PersonId;
            entity.d_Fecha           = dto.d_Fecha;
            entity.v_Descripcion     = dto.v_Descripcion;
            entity.i_EsControlado    = dto.i_EsControlado;
            entity.v_Observacion     = dto.v_Observacion;
            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;
            entity.v_ComentaryUpdate = dto.v_ComentaryUpdate;

            dto.OnEntity(entity);

            return(entity);
        }
Example #2
0
        /// <summary>
        /// Converts this instance of <see cref="problema"/> to an instance of <see cref="problemaDto"/>.
        /// </summary>
        /// <param name="entity"><see cref="problema"/> to convert.</param>
        public static problemaDto ToDTO(this problema entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var dto = new problemaDto();

            dto.v_ProblemaId      = entity.v_ProblemaId;
            dto.i_Tipo            = entity.i_Tipo;
            dto.v_PersonId        = entity.v_PersonId;
            dto.d_Fecha           = entity.d_Fecha;
            dto.v_Descripcion     = entity.v_Descripcion;
            dto.i_EsControlado    = entity.i_EsControlado;
            dto.v_Observacion     = entity.v_Observacion;
            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;
            dto.v_ComentaryUpdate = entity.v_ComentaryUpdate;

            entity.OnDTO(dto);

            return(dto);
        }
Example #3
0
        public void UpdateProblema(ref OperationResult pobjOperationResult, problemaDto pobjDtoEntity, List <string> ClientSession)
        {
            //mon.IsActive = true;

            try
            {
                SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel();

                // Obtener la entidad fuente
                var objEntitySource = (from a in dbContext.problema
                                       where a.v_ProblemaId == pobjDtoEntity.v_ProblemaId
                                       select a).FirstOrDefault();

                // Crear la entidad con los datos actualizados
                pobjDtoEntity.d_UpdateDate   = DateTime.Now;
                pobjDtoEntity.i_UpdateUserId = Int32.Parse(ClientSession[2]);
                problema objEntity = problemaAssembler.ToEntity(pobjDtoEntity);

                // Copiar los valores desde la entidad actualizada a la Entidad Fuente
                dbContext.problema.ApplyCurrentValues(objEntity);

                // Guardar los cambios
                dbContext.SaveChanges();

                pobjOperationResult.Success = 1;
                return;
            }
            catch (Exception ex)
            {
                pobjOperationResult.Success          = 0;
                pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex);
                return;
            }
        }
Example #4
0
        public void AddProblema(ref OperationResult pobjOperationResult, problemaDto pobjDtoEntity, List <string> ClientSession)
        {
            //mon.IsActive = true;
            string NewId = "(No generado)";

            try
            {
                SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel();
                problema objEntity = problemaAssembler.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 = int.Parse(ClientSession[0]);
                NewId = Common.Utils.GetNewId(intNodeId, Utils.GetNextSecuentialId(intNodeId, 326), "PM");;
                objEntity.v_ProblemaId = NewId;

                dbContext.AddToproblema(objEntity);
                dbContext.SaveChanges();

                pobjOperationResult.Success = 1;
                return;
            }
            catch (Exception ex)
            {
                pobjOperationResult.Success          = 0;
                pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex);
                return;
            }
        }
Example #5
0
        public problema buscarProblema(int id)
        {
            pc = dm.GetproblemaCollection();
            problema p = pc.FindByid(id);

            return(p);
        }
Example #6
0
        private void dgvHistorialP_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            btnEFP.Enabled = true;
            btnMFP.Enabled = true;
            id_fproblema   = (int)dgvHistorialP.CurrentRow.Cells[0].Value;
            problema p = negocioMant.buscarProblema(id_fproblema);

            edtMotivoP.Text = p.motivo;
            dtpFechaP.Value = (DateTime)p.fecha;
            List <maquina> mc = negocioM.listar();
            int            c  = 0;

            foreach (maquina m in mc)
            {
                if (m.id == p.idmaquina && m.estado2 != false)
                {
                    cbxMaquinaR.SelectedIndex = c;

                    btnMR.Enabled = true; btnER.Enabled = true; btnNR.Enabled = false;
                    return;
                }
                c++;
            }
            MessageBox.Show("DEBE ACTUALIZAR EL CAMPO MAQUINA.");
            cbxMaquinaR.SelectedIndex = -1;
        }
Example #7
0
        public void eliminarProblema(int id)
        {
            pc = dm.GetproblemaCollection();
            problema p = pc.FindByid(id);

            p.estado = false;
            dm.CommitAll();
        }
Example #8
0
        public void modificarProblema(int id, DateTime t, string motivo, string id_maquina)
        {
            pc = dm.GetproblemaCollection();
            problema p = pc.FindByid(id);

            p.fecha     = t;
            p.motivo    = motivo;
            p.idmaquina = id_maquina;
            dm.CommitAll();
        }
Example #9
0
        static void Main(string[] args)
        {
            problema p = new problema();

            Console.WriteLine("Esciba el nombre de los planetas pero antes el número");
            int    n = Convert.ToInt32(Console.ReadLine());
            String nomp;

            for (int i = 0; i < n; ++i)
            {
                nomp = Console.ReadLine();
                p.AddPlaneta(nomp);
            }
            String sn;

            Console.WriteLine("Quiere mostrar los planetas que ha añadido?");
            sn = Console.ReadLine();
            if (sn == "si" || sn == "Si" || sn == "SI")
            {
                p.mostrarPlanetas();
            }

            p.MostrarOpciones();

            n = Convert.ToInt32(Console.ReadLine());

            while (n != 0)
            {
                if (n == 1)
                {
                    p.AddRebelde();
                }
                else if (n == 2)
                {
                    p.findRebel();
                }
                else if (n == 3)
                {
                    p.MostrarRebeldes();
                }
                Console.WriteLine();
                Console.ReadKey();
                p.MostrarOpciones();
                n = Convert.ToInt32(Console.ReadLine());
            }
        }
Example #10
0
 /// <summary>
 /// Invoked when <see cref="ToEntity"/> operation is about to return.
 /// </summary>
 /// <param name="entity"><see cref="problema"/> converted from <see cref="problemaDto"/>.</param>
 static partial void OnEntity(this problemaDto dto, problema entity);
Example #11
0
 /// <summary>
 /// Invoked when <see cref="ToDTO"/> operation is about to return.
 /// </summary>
 /// <param name="dto"><see cref="problemaDto"/> converted from <see cref="problema"/>.</param>
 static partial void OnDTO(this problema entity, problemaDto dto);