Exemple #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Titulares titulares = db.Titulares.Find(id);

            db.Titulares.Remove(titulares);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #2
0
 public ActionResult Edit([Bind(Include = "id_titular,id_paciente,id_membresia,habilitado,fecha_registro")] Titulares titulares)
 {
     if (ModelState.IsValid)
     {
         db.Entry(titulares).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.id_membresia = new SelectList(db.Membresias, "id_membresia", "descripcion", titulares.id_membresia);
     ViewBag.id_paciente  = new SelectList(db.Pacientes, "id_paciente", "nombre", titulares.id_paciente);
     return(View(titulares));
 }
Exemple #3
0
        // GET: Titulares/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Titulares titulares = db.Titulares.Find(id);

            if (titulares == null)
            {
                return(HttpNotFound());
            }
            return(View(titulares));
        }
Exemple #4
0
        // GET: Titulares/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Titulares titulares = db.Titulares.Find(id);

            if (titulares == null)
            {
                return(HttpNotFound());
            }
            ViewBag.id_membresia = new SelectList(db.Membresias, "id_membresia", "descripcion", titulares.id_membresia);
            ViewBag.id_paciente  = new SelectList(db.Pacientes, "id_paciente", "nombre", titulares.id_paciente);
            return(View(titulares));
        }
        public Titulares ConsultaTitular()
        {
            Titulares _Retorno = new Titulares();

            try
            {
                using (HanaConnection conn = new HanaConnection(ConfigurationManager.ConnectionStrings["Hana"].ConnectionString))
                {
                    conn.Open();

                    var Schema = ConfigurationManager.AppSettings["CompanyDB"];

                    string Sql = string.Format(Properties.Resources.ConsultaTitular, Schema);

                    using (HanaCommand cmd3 = new HanaCommand(Sql, conn))
                    {
                        using (HanaDataReader productInfoReader3 = cmd3.ExecuteReader())
                        {
                            HanaCommand    cmd = new HanaCommand(Sql, conn);
                            HanaDataReader productInfoReader = cmd.ExecuteReader();

                            if (productInfoReader.HasRows)
                            {
                                productInfoReader.Read();

                                string Code  = productInfoReader.GetString(0);
                                string Name  = productInfoReader.GetString(1);
                                string Count = productInfoReader.GetString(2);

                                _Retorno.value         = new Titular[int.Parse(Count)];
                                _Retorno.value[0]      = new Titular();
                                _Retorno.value[0].Code = Code;
                                _Retorno.value[0].Name = Name;

                                int i = 1;
                                while (productInfoReader.Read())
                                {
                                    Code = productInfoReader.GetString(0);
                                    Name = productInfoReader.GetString(1);

                                    _Retorno.value[i]      = new Titular();
                                    _Retorno.value[i].Code = Code;
                                    _Retorno.value[i].Name = Name;

                                    i++;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message);
            }
            finally
            {
            }

            return(_Retorno);
        }