public List <Sala> getListSALAS()
 {
     using (var db = new Cinema_Model())
     {
         return(db.Sala.ToList());
     }
 }
Exemple #2
0
 private void btn_Update_Click(object sender, EventArgs e)
 {
     cinema_Model = new Cinema_Model();
     if (PerformValidation(groupBox1))
     {
         ATB();
         bool DialogDel = MessageBox.Show("Are you sure to EDIT this Data", "EDIT", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes;
         if (DialogDel)
         {
             CinemaCRUD = new Cinema_CRUD_Service();
             if (CinemaCRUD.Update(cinema_Model))
             {
                 MessageBox.Show("Data UPDATED !!");
                 this.Close();
             }
             else
             {
                 MessageBox.Show("Data FAILED UPDATED !!");
                 this.Close();
             }
         }
         else
         {
         }
         ((FrmEditCinema)f).displaydatagrid();
     }
 }
 public List <Tipo_sala> getlistTipo_Sala()
 {
     using (var db = new Cinema_Model())
     {
         return(db.Tipo_sala.ToList());
     }
 }
 /*Método para obtener los id de sala*/
 public List <Sala> getSala()//método para obtener todos los datos del asiento
 {
     using (var db = new Cinema_Model())
     {
         return(db.Sala.ToList());
     }
 }
 public List <Asiento> GetAsiento()//método para obtener todos los datos del asiento
 {
     using (var db = new Cinema_Model())
     {
         return(db.Asiento.ToList());
     }
 }
Exemple #6
0
        public bool Update(Cinema_Model cinema_Model)
        {
            bool result = false;

            try
            {
                DBCon = new DBConnection();
                query = string.Format(@"UPDATE `cinemas`
                                        SET 
                                            `cinema_name` = '{0}',
                                            `movie_name` = '{1}',
                                            `theather` = '{2}',
                                            `time` = '{3}',
                                            `class` = '{4}'
                                        WHERE `cinema_id` = '{5}';",
                                      cinema_Model.Cinema_Name,
                                      cinema_Model.Movie_name,
                                      cinema_Model.Theather,
                                      cinema_Model.Time,
                                      cinema_Model.Class,
                                      cinema_Model.Cinema_Id);

                DBCon.ConnectionOpen();
                cmd    = new MySqlCommand(query, DBCon.Connection);
                result = cmd.ExecuteNonQuery() == 1;
                DBCon.ConnectionClose();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            return(result);
        }
Exemple #7
0
        public bool Insert(Cinema_Model cinema_Model)
        {
            bool result = false;

            query = "INSERT INTO `cinemas`(`cinema_name`,`movie_name`,`theather`,`time`,`class`)" +
                    "VALUES(@cinema_name,@movie_name,@theather,@time,@class)";

            using (MySqlCommand cmd = new MySqlCommand(query, conn))
            {
                cmd.Parameters.Add("@cinema_name", cinema_Model.Cinema_Name);
                cmd.Parameters.Add("@movie_name", cinema_Model.Movie_name);
                cmd.Parameters.Add("@theather", cinema_Model.Theather);
                cmd.Parameters.Add("@time", cinema_Model.Time);
                cmd.Parameters.Add("@class", cinema_Model.Class);
                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                    conn.Close();
                    return(result = true);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                    return(result);
                }
            }
        }
Exemple #8
0
 public void LoadForm()
 {
     cinema_Model        = new Cinema_Model();
     txt_CinemaName.Text = ((FrmEditCinema)f).txt_CinemaName.Text;
     txt_MovieName.Text  = ((FrmEditCinema)f).txt_MovieName.Text;
     txt_Theather.Text   = ((FrmEditCinema)f).txt_Theather.Text;
     txt_Time.Text       = ((FrmEditCinema)f).txt_Time.Text;
     txt_Class.Text      = ((FrmEditCinema)f).txt_Class.Text;
 }
Exemple #9
0
 public void ATB()
 {
     cinema_Model             = new Cinema_Model();
     cinema_Model.Cinema_Name = txt_CinemaName.Text;
     cinema_Model.Movie_name  = txt_MovieName.Text;
     cinema_Model.Theather    = txt_Theather.Text;
     cinema_Model.Time        = txt_Time.Text;
     cinema_Model.Class       = txt_Class.Text;
 }
 public void AgregarSala(Sala item)
 {
     try
     {
         using (var db = new Cinema_Model())
         {
             db.Sala.Add(item);
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         throw new Exception("Verifica los datos a Insertar");//es un error que yo creo
     }
 }
        public List <vSala> Sala_c_tipo()
        {
            List <vSala> obj = new List <vSala>();

            using (var db = new Cinema_Model())
            {
                obj = (from x in db.Sala
                       select new vSala
                {
                    Cod_sala = x.Cod_sala,
                    Num_sala = x.Num_sala,
                    cod_tipo = x.cod_tipo,
                    NombreSala_tipo = x.Tipo_sala.Nombre_sala
                }).ToList();
                return(obj);
            }
        }
        public List <vAsiento> AsientoComplete()
        {
            List <vAsiento> obj = new List <vAsiento>();

            using (var db = new Cinema_Model())
            {
                obj = (from x in db.Asiento
                       select new vAsiento
                {
                    id_siento = x.id_siento,
                    fila = x.fila,
                    columna = x.columna,
                    Cod_sala = x.Cod_sala,
                    Num_sala = x.Sala.Cod_sala
                }).ToList();
                return(obj);
            }
        }
        public List <Sala> getListSala(Hashtable datos)
        {
            try
            {
                using (var db = new Cinema_Model())
                {
                    string                 query      = @"SELECT VALUE SALA FROM Cinema_Model.Sala As Sala";
                    StringBuilder          wheereis   = new StringBuilder();
                    List <ObjectParameter> parameters = new List <ObjectParameter>();
                    if (datos.Contains("NUM_SALA"))
                    {
                        if (wheereis.Length > 0)
                        {
                            wheereis.Append(" AND ");
                        }
                        wheereis.Append("Sala.NUM_SALA=@NUM_SALA");
                        parameters.Add(new ObjectParameter("NUM_SALA", datos["NUM_SALA"]));
                    }


                    if (wheereis.Length > 0)
                    {
                        query += " WHERE " + wheereis.ToString();
                    }

                    ObjectContext oc;
                    oc = ((IObjectContextAdapter)db).ObjectContext;

                    var q = new ObjectQuery <Sala>(query, oc);
                    if (wheereis.Length > 0)
                    {
                        foreach (ObjectParameter parametro in parameters)
                        {
                            q.Parameters.Add(parametro);
                        }
                    }
                    return(q.ToList());
                }
            }
            catch (Exception e)
            {
                throw new Exception("Verifica los datos a buscar");
            }
        }
 public void BorrarSala(Sala item)
 {
     try
     {
         using (var db = new Cinema_Model())
         {
             Sala obj = db.Sala.Where(x => x.Num_sala == item.Num_sala).FirstOrDefault();
             if (obj != null)
             {
                 MessageBox.Show("si entro");
                 db.Sala.Remove(obj);
                 db.SaveChanges();
             }
         }
     }
     catch (Exception e)
     {
         throw new Exception("Verifica los datos a Eliminar");//es un error que yo creo
     }
 }
 public void ModificarSala(Sala item)
 {
     try
     {
         using (var db = new Cinema_Model())
         {
             Sala obj = db.Sala.Where(x => x.Cod_sala == item.Cod_sala).FirstOrDefault();
             if (obj != null)
             {
                 obj.Num_sala = item.Num_sala;
                 obj.cod_tipo = item.cod_tipo;
                 db.SaveChanges();
             }
         }
     }
     catch (Exception e)
     {
         throw new Exception("Verifica los datos a Actualizar");//es un error que yo creo
     }
 }