Пример #1
0
        private void InicioTipoMantenimiento()
        {
            switch (TipoMnt)
            {
            case TipoMantenimiento.Nuevo:
                pkIdEntidad.EditValue = IdEntidadMnt;
                CargarReferencias();
                ValoresPorDefecto();
                btnEliminar.Enabled   = false;
                btnActualizar.Enabled = false;

                PrioridadMnt = new Prioridad();

                if (PrioridadMnt != null && PrioridadMnt.Idprioridad > 0)
                {
                    //         iIdtipodocent.EditValue = PrioridadMnt.Idtipodocent;
                    //          iDiascondicion.EditValue = PrioridadMnt.Nrodocentidad;

                    btnNuevo.Enabled       = false;
                    btnGrabarNuevo.Enabled = false;
                    btnGrabar.Enabled      = false;
                }

                break;

            case TipoMantenimiento.Modificar:
                pkIdEntidad.EditValue = IdEntidadMnt;
                CargarReferencias();
                TraerDatos();
                break;
            }
        }
        public async Task <ActionResult <Prioridad> > PostPrioridad(Prioridad prioridad)
        {
            _context.Prioridades.Add(prioridad);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPrioridad", new { id = prioridad.prioridadId }, prioridad));
        }
        public async Task <IActionResult> PutPrioridad(int id, Prioridad prioridad)
        {
            if (id != prioridad.prioridadId)
            {
                return(BadRequest());
            }

            _context.Entry(prioridad).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PrioridadExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #4
0
        public int RegistrarPrioridad([FromBody] Prioridad objPrioridad)
        {
            clsPrioridad objClsPrioridad;

            Abm.PrioridadV objValidarCanal;

            try
            {
                objClsPrioridad = new clsPrioridad();
                objValidarCanal = new Abm.PrioridadV();
                objValidarCanal = objClsPrioridad.ValidarPrioridad(objPrioridad.pri_nombre);

                if (objValidarCanal == null)
                {
                    objClsPrioridad = new clsPrioridad();
                    return(objClsPrioridad.RegistrarPrioridad(objPrioridad));
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                objClsPrioridad = null;
                objValidarCanal = null;
            }
        }
Пример #5
0
 public ActionResult Index(Int32?Id, Int16?Orden)
 {
     //if (!String.IsNullOrEmpty(Id.ToString()) && !String.IsNullOrEmpty(Orden.ToString()))
     if (!String.IsNullOrEmpty(Id.ToString()))
     {
         Prioridad prioridad = db.Prioridads.Find(Id);
         if (prioridad == null)
         {
             return(HttpNotFound());
         }
         var IdUser = "";
         if (User.Identity.IsAuthenticated)
         {
             string currentUserId = User.Identity.GetUserId();
             IdUser = currentUserId;
         }
         if (Orden == prioridad.Orden)
         {
             prioridad.Orden = Convert.ToInt16(Orden + 1);
         }
         else
         {
             prioridad.Orden = Convert.ToInt16(Orden - 1);
         }
         db.Prioridads.Attach(prioridad);
         db.SaveChanges();
     }
     ViewBag.orden = Id;
     return(View());
 }
Пример #6
0
        public ActionResult Edit([Bind(Include = "Id,UserId,Nombre,Orden")] Prioridad prioridad)
        {
            if (ModelState.IsValid)
            {
                var IdUser = "";
                if (User.Identity.IsAuthenticated)
                {
                    string currentUserId = User.Identity.GetUserId();
                    IdUser = currentUserId;
                }
                var LstOrden_1 = db.Prioridads.Where(x => x.UserId == IdUser).OrderBy(x => x.Orden);
                var Cuantas    = LstOrden_1.Count();
                ViewBag.Orden = new SelectList(LstOrden_1, "Id", "Orden", prioridad.Orden);
                //var norden = prioridad.Orden;
                //if (norden < 0)
                //{
                //    prioridad.Orden = 1;
                //}
                //else
                //{

                //}
                prioridad.UserId          = IdUser;
                db.Entry(prioridad).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(prioridad));
        }
Пример #7
0
 public AptitudPorAviso(long AvisoId, long AptitudId, Aptitud aptitud, Prioridad p)
 {
     this.Aviso_Id   = AvisoId;
     this.Aptitud_Id = AptitudId;
     this.Aptitud    = aptitud;
     this.Prioridad  = p;
 }
        public List <Prioridad> listar()
        {
            AccesoaDatos     datos = new AccesoaDatos();
            Prioridad        prioridad;
            List <Prioridad> lista = new List <Prioridad>();

            try
            {
                datos.SetearQuery("SELECT * FROM Prioridades");
                datos.EjecutarLector();
                while (datos.lector.Read())
                {
                    prioridad        = new Prioridad();
                    prioridad.ID     = datos.lector.GetInt32(0);
                    prioridad.Nombre = datos.lector.GetString(1);
                    lista.Add(prioridad);
                }
                return(lista);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                datos.CerrarConexion();
            }
        }
Пример #9
0
 protected void btnAccept_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         if (!DataOk())
         {
             return;
         }
         if (newRecord)
         {
             prioridad = new Prioridad();
         }
         UnloadData(prioridad);
         if (newRecord)
         {
             ctx.Add(prioridad);
         }
         ctx.SaveChanges();
         if (newRecord)
         {
             RadAjaxManager1.ResponseScripts.Add(String.Format("closeWindowRefreshGrid('{0}', 'new');"
                                                               , caller));
         }
         else
         {
             RadAjaxManager1.ResponseScripts.Add(String.Format("closeWindowRefreshGrid('{0}', 'edit');"
                                                               , caller));
         }
     }
     catch (Exception ex)
     {
         ControlDeError(ex);
     }
 }
Пример #10
0
        public List <Prioridad> listarPrioridades()
        {
            List <Prioridad>   listado     = new List <Prioridad>();
            AccesoDatosManager accesoDatos = new AccesoDatosManager();
            Prioridad          prioridad   = new Prioridad();

            try
            {
                accesoDatos.setearConsulta("select ID,Nombre from PRIORIDADES");
                accesoDatos.abrirConexion();
                accesoDatos.ejecutarConsulta();
                while (accesoDatos.Lector.Read())
                {
                    prioridad               = new Prioridad();
                    prioridad.ID            = (int)accesoDatos.Lector["ID"];
                    prioridad.TipoPrioridad = accesoDatos.Lector["Nombre"].ToString();
                    listado.Add(prioridad);
                }
                return(listado);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                accesoDatos.cerrarConexion();
            }
        }
Пример #11
0
    static public void Main()
    {
        Prioridad p = new Prioridad();

        ThreadStart del = new ThreadStart(p.creador);

        Thread hilo1 = new Thread(del);

        hilo1.Name = "Hilo 1";
        Thread hilo2 = new Thread(del);

        hilo2.Name     = "Hilo 2";
        hilo2.Priority = ThreadPriority.BelowNormal;
        Thread hilo3 = new Thread(del);

        hilo3.Name     = "Hilo 3";
        hilo3.Priority = ThreadPriority.AboveNormal;

        hilo1.Start();
        hilo2.Start();
        hilo3.Start();

        Thread.Sleep(10000);

        Console.ReadLine();
    }
        public string String()
        {
            string texto = Desarrollador + ",";

            if (Titulo.Contains(','))
            {
                texto += "\"" + Titulo + "\"" + ",";
            }
            else
            {
                texto += Titulo + ",";
            }
            if (Descripcion.Contains(','))
            {
                texto += "\"" + Descripcion + "\"" + ",";
            }
            else
            {
                texto += Descripcion + ",";
            }
            if (Proyecto.Contains(','))
            {
                texto += "\"" + Proyecto + "\"" + ",";
            }
            else
            {
                texto += Proyecto + ",";
            }
            texto += Entrega.ToString("dd/MM/yyyy") + ",";
            texto += Prioridad.ToString();
            return(texto);
        }
Пример #13
0
        public ActionResult DeleteConfirmed(int id)
        {
            Prioridad prioridad = db.Prioridads.Find(id);

            db.Prioridads.Remove(prioridad);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #14
0
        private Prioridad map(DataRow row)
        {
            Prioridad oPrioridad = new Prioridad();

            oPrioridad.id_prioridad = Convert.ToInt32(row["id_prioridad"].ToString());
            oPrioridad.nombre       = row["n_prioridad"].ToString();
            return(oPrioridad);
        }
Пример #15
0
        public void EnviarCorreo(Prioridad prioridad)
        {
            MailMessage mail = new MailMessage();

            String[] emails = EmailDestino.Split(';');
            foreach (String email in emails)
            {
                if (!email.Trim().Equals(""))
                {
                    mail.To.Add(email);
                }
            }
            if (archivosAdjuntos != null)
            {
                foreach (Adjunto adjunto in archivosAdjuntos)
                {
                    Attachment         data        = new Attachment(adjunto.Stream, MediaTypeNames.Application.Octet);
                    ContentDisposition disposition = data.ContentDisposition;
                    disposition.FileName = adjunto.NombreArchivo;
                    mail.Attachments.Add(data);
                }
            }
            String emailUsar = EmailUsar;

            mail.From            = new MailAddress(emailUsar, NombreAMostrar, System.Text.Encoding.UTF8);
            mail.Subject         = Asunto;
            mail.SubjectEncoding = System.Text.Encoding.UTF8;
            mail.Body            = ContenidoHTML;
            mail.BodyEncoding    = System.Text.Encoding.UTF8;
            mail.IsBodyHtml      = true;
            if (prioridad == Prioridad.Alta)
            {
                mail.Priority = MailPriority.High;
            }
            else if (prioridad == Prioridad.Normal)
            {
                mail.Priority = MailPriority.Normal;
            }
            else if (prioridad == Prioridad.Baja)
            {
                mail.Priority = MailPriority.Low;
            }

            SmtpClient client = new SmtpClient();

            client.Credentials = new System.Net.NetworkCredential(emailUsar, ContrasenaUsar);
            client.Port        = 587;
            client.Host        = "smtp.gmail.com";
            client.EnableSsl   = true;
            try
            {
                client.Send(mail);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Пример #16
0
        public void ExportarXML()
        {
            try
            {
                // validar si existe el directorio sino lo crea
                if (!Directory.Exists(@"c:\temp"))
                {
                    Directory.CreateDirectory(@"c:\temp");
                }

                StreamWriter xml = new StreamWriter(@"c:\temp\facil.xml");

                XmlDocument documento = new XmlDocument();
                XmlElement  raiz      = documento.CreateElement("Incidentes");
                documento.AppendChild(raiz);


                XmlElement incidentex = documento.CreateElement("Incidente");
                raiz.AppendChild(incidentex);

                XmlElement nombrex = documento.CreateElement("Nombre");
                nombrex.AppendChild(documento.CreateTextNode(Nombre));
                incidentex.AppendChild(nombrex);

                XmlElement descripcionx = documento.CreateElement("Descripcion");
                descripcionx.AppendChild(documento.CreateTextNode(Descripcion));
                incidentex.AppendChild(descripcionx);

                XmlElement prioridadx = documento.CreateElement("Prioridad");
                prioridadx.AppendChild(documento.CreateTextNode(Prioridad.ToString()));
                incidentex.AppendChild(prioridadx);

                XmlElement duracionx = documento.CreateElement("Duracion");
                duracionx.AppendChild(documento.CreateTextNode(Duracion.ToString()));
                incidentex.AppendChild(duracionx);

                XmlElement gravedadx = documento.CreateElement("Gravedad");
                gravedadx.AppendChild(documento.CreateTextNode(Gravedad.ToString()));
                incidentex.AppendChild(gravedadx);

                XmlElement totalx = documento.CreateElement("total");
                totalx.AppendChild(documento.CreateTextNode(costo().ToString()));
                incidentex.AppendChild(totalx);


                // Salvar el archivo
                xml.Write(documento.OuterXml);
                xml.Close();

                Process.Start(@"c:\temp\facil.xml");
            }
            catch (Exception er)
            {
                MessageBox.Show("Error :" + er.Message, "Atención", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #17
0
        private Prioridad MappingBug(DataRow row)
        {
            Prioridad oPrioridad = new Prioridad
            {
                IdPrioridad = Convert.ToInt32(row["id_prioridad"].ToString()),
                Nombre      = row["nombre"].ToString()
            };

            return(oPrioridad);
        }
Пример #18
0
        private static void CargarPrioridad(Prioridad prioridad, SqlCeConnection conn, LainsaSci ctx)
        {
            TPrioridad tp = new TPrioridad()
            {
                PrioridadId = prioridad.PrioridadId,
                Nombre      = prioridad.Nombre
            };

            CntSciTerminal.TSave(tp, conn);
        }
Пример #19
0
 public ActionResult Edit([Bind(Include = "Id,UserId,Nombre,Orden")] Prioridad prioridad)
 {
     if (ModelState.IsValid)
     {
         db.Entry(prioridad).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(prioridad));
 }
Пример #20
0
        public void ItemsController_AgrearItemAProyecto()
        {
            HelperTestSistema.LimpiarArchivoBD();
            HelperTestSistema.IniciarServidor();

            //Creamos un proyecto y lo guardamos directamente en la base de datos
            var proyecto = HelperInstanciacionProyectos.GetProyectos(1)[0];

            using (IContextoProceso contexto = new ContextoProceso(HelperTestSistema.ObjectFactory))
            {
                contexto.ContenedorObjetos.Store(proyecto);
            }

            //Instanciamos un nuevo item y lo agregamos al proyecto

            Item nuevoItem = new Item(
                "Item  test", "Descripcion item test",
                new TipoItem("Tipo 1", "Tipo 1 test"),
                new Prioridad("Prioridad 1", "Prioridad de prueba"));

            var controller = new ItemsController(HelperTestSistema.ObjectFactory);

            controller.Post("P1", nuevoItem);

            //Obtenemos los datos de la BD para validarlos
            var proyectosBD = new List <Proyecto>();
            var tipoItem    = new TipoItem();
            var prioridad   = new Prioridad("", "");

            using (IContextoProceso contexto = new ContextoProceso(HelperTestSistema.ObjectFactory))
            {
                proyectosBD = (from Proyecto p in contexto.ContenedorObjetos select p).ToList();
                prioridad   = (from Prioridad p in contexto.ContenedorObjetos select p).SingleOrDefault();
                tipoItem    = (from TipoItem ti in contexto.ContenedorObjetos select ti).SingleOrDefault();
            }

            HelperTestSistema.ReiniciarConexion();
            HelperTestSistema.FinalizarServidor();

            //Asserts
            Assert.Inconclusive("Refactorizar y terminar este test");
            //Tiene que haber un solo proyecto en la BD
            Assert.AreEqual(1, proyectosBD.Count);
            //El proyecto debe tener un item
            Assert.AreEqual(1, proyectosBD[0].Items.Count());
            //El  item debe tener el nombre y la descripcion correcta
            Assert.AreEqual("Descripcion item test", proyectosBD[0].Items.ToList()[0].Descripcion);
            //El  item debe tener la prioridad correcta
            Assert.AreSame(prioridad, proyectosBD[0].Items.ToList()[0].Prioridad);
            Assert.AreEqual("Prioridad 1", proyectosBD[0].Items.ToList()[0].Prioridad.Nombre);
            //El item debe tener asignado el tipo de item correcto
            Assert.AreSame(tipoItem, proyectosBD[0].Items.ToList()[0].TipoItem);
            Assert.AreEqual("Tipo 1", proyectosBD[0].Items.ToList()[0].TipoItem.Nombre);
        }
Пример #21
0
 protected void LoadData(Prioridad prioridad)
 {
     txtPrioridadId.Text = prioridad.PrioridadId.ToString();
     txtNombre.Text      = prioridad.Nombre;
     if (prioridad.Empresa != null)
     {
         rdcEmpresa.Items.Clear();
         rdcEmpresa.Items.Add(new RadComboBoxItem(prioridad.Empresa.Nombre, prioridad.Empresa.EmpresaId.ToString()));
         rdcEmpresa.SelectedValue = prioridad.Empresa.EmpresaId.ToString();
     }
 }
Пример #22
0
        public ActionResult Create([Bind(Include = "Id,UserId,Nombre,Orden")] Prioridad prioridad)
        {
            if (ModelState.IsValid)
            {
                db.Prioridads.Add(prioridad);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(prioridad));
        }
Пример #23
0
        public HttpResponseMessage SavePrioridad([FromBody] Prioridad prioridad)
        {
            bool SuccesfullSaved = PrioridadHelper.Save(prioridad);

            if (!SuccesfullSaved)
            {
                throw new HttpResponseException(HttpStatusCode.InternalServerError);
            }

            return(Request.CreateResponse(HttpStatusCode.Created));
        }
Пример #24
0
 protected void UnloadData(Prioridad prioridad)
 {
     prioridad.Nombre = txtNombre.Text;
     if (rdcEmpresa.SelectedValue != "")
     {
         prioridad.Empresa = CntLainsaSci.GetEmpresa(int.Parse(rdcEmpresa.SelectedValue), ctx);
     }
     else
     {
         prioridad.Empresa = null;
     }
 }
Пример #25
0
 public void Update(Prioridad myObject)
 {
     try
     {
         _repository.Update(myObject);
         _unitOfWork.Commit();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Пример #26
0
        public static PRIORIDAD ToTable(this Prioridad Model)
        {
            if (Model == null)
            {
                return(null);
            }

            return(new PRIORIDAD()
            {
                Id = Model.Id,
                Descripcion = Model.Descripcion
            });
        }
Пример #27
0
 /// <summary>
 /// Remueve y retorna el Paciente que se encuentra al comienzo de la cola de mayor prioridad.
 /// </summary>
 /// <returns>Retorna un Paciente o un PacienteNulo si la cola está vacía.</returns>
 public Paciente Atender( )
 {
     if (!Vacia)
     {
         for (Prioridad i = Prioridad.rojo; i <= Prioridad.azul; i++)
         {
             if (!this._cola[i].Vacia)
             {
                 return(this._cola[i].Atender());
             }
         }
     }
     return(cPacienteNulo);
 }
Пример #28
0
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Prioridad prioridad = db.Prioridads.Find(id);

            if (prioridad == null)
            {
                return(HttpNotFound());
            }
            return(View(prioridad));
        }
Пример #29
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Del")
            {
                try
                {
                    int rowIndex = Convert.ToInt32(e.CommandArgument);
                    int id       = Convert.ToInt32(gvPrioridades.Rows[rowIndex].Cells[0].Text);

                    using (proyecto_finalEntities entidades = new proyecto_finalEntities())
                    {
                        Prioridad prioridades = entidades.Prioridads.SingleOrDefault(c => c.Id == id);
                        entidades.Prioridads.Remove(prioridades);
                        entidades.SaveChanges();
                        cargarPrioridades();
                    }
                }
                catch (Exception sqlEx)
                {
                    LblMessage.Text = "Error al eliminar datos." + sqlEx.Message;
                }
            }

            if (e.CommandName == "Upd")
            {
                try
                {
                    int rowIndex = Convert.ToInt32(e.CommandArgument);
                    int id       = Convert.ToInt32(gvPrioridades.Rows[rowIndex].Cells[0].Text);

                    using (proyecto_finalEntities entidades = new proyecto_finalEntities())
                    {
                        Prioridad prioridades = entidades.Prioridads.SingleOrDefault(c => c.Id == id);

                        txtId.Text              = Convert.ToString(prioridades.Id);
                        txtNombre.Text          = prioridades.Nombre;
                        txtDescripcion.Text     = prioridades.Descripcion;
                        this.tabla.Visible      = false;
                        this.formulario.Visible = true;
                        this.btnNuevo.Visible   = false;
                        entidades.SaveChanges();
                    }
                }
                catch (Exception sqlEx)
                {
                    LblMessage.Text = "Error al eliminar datos." + sqlEx.Message;
                }
            }
        }
Пример #30
0
 private void TraerDatos()
 {
     try
     {
         PrioridadMnt = Service.GetPrioridad(IdEntidadMnt);
         rCodigoprioridad.EditValue = PrioridadMnt.Codigoprioridad;
         iNombreprioridad.EditValue = PrioridadMnt.Nombreprioridad;
     }
     catch
     {
         DeshabilitarBtnMnt();
         LimpiarCampos();
         throw;
     }
 }
        public Incidente()
        {
            _atenciones = new BindingList<Atencion>();
            _solicitudCambio = new SolicitudCambio();
            _tipoIncidente = new TipoIncidente();
            _elemento = new Elemento();
            _impacto = new Impacto();
            _plataforma = new Plataforma();
            _prioridad = new Prioridad();
            _solicitudCambio = new SolicitudCambio();

            _categoria = new Categoria();
            _subCategoria = new SubCategoria();

            _usuarioDeriva = new Usuario();
            _usuarioAsigna = new Usuario();
            _asesor = new Usuario();

            _area = new Area();
            _sede = new Sede();

            _usuarioContacto = new Usuario();
        }
        public void Dispose()
        {
            _solicitudCambio = null;
            _tipoIncidente = null;
            _elemento = null;
            _impacto = null;
            _plataforma = null;
            _prioridad = null;
            _solicitudCambio = null;

            _categoria = null;
            _subCategoria = null;

            _usuarioDeriva = null;
            _usuarioAsigna = null;
            _asesor = null;

            _area = null;
            _sede = null;

            _usuarioContacto = null;

            _atenciones = null;
        }