示例#1
0
        public static EstadoOperacion eliminarTabla(TABLA tabla)
        {
            DbFactory Factoria = DataAccessFactory.ObtenerProveedor();
            try
            {
                using (Switch contexto = new Switch())
                {
                    using (contexto.CreateConeccionScope())
                    {
                        string query = "EliminarTabla";

                        DbCommand Comando = contexto.CreateCommand(query, CommandType.StoredProcedure);
                        Comando.Parameters.Add(Factoria.CrearParametro("@codigo", tabla.TBL_CODIGO));

                        if (Comando.ExecuteNonQuery() != 1)
                        {
                            return new EstadoOperacion(false, null, null);
                        }

                        return new EstadoOperacion(true, null, null);
                    }
                }
            }
            catch (DbException dbex)
            {
                return new EstadoOperacion(false, dbex.Message, dbex);
            }
            catch (Exception e)
            {

                return new EstadoOperacion(false, e.Message, e);
            }
        }
 protected void dsTabla_Selected(object sender, ObjectDataSourceStatusEventArgs e)
 {
     List<TABLA> lista = (List<TABLA>)e.ReturnValue;
     if (lista.Count == 0)
     {
         TABLA tabla = new TABLA();
         tabla.TBL_NOMBRE = "";
         tabla.TBL_DESCRIPCION = "";
         lista.Add(tabla);
     }
 }
示例#3
0
        private void button6_Click_1(object sender, EventArgs e)
        {
            if (comboBox1.SelectedItem == "1")
            {
                TABLE = NR1.Text + " " + TR1.Text;
            }
            else if (comboBox1.SelectedItem == "2")
            {
                TABLE = NR1.Text + " " + TR1.Text + " ," + NR2.Text + " " + TR2.Text;
            }
            else if (comboBox1.SelectedItem == "3")
            {
                TABLE = NR1.Text + " " + TR1.Text + " ," + NR2.Text + " " + TR3.Text + " ," + NR3.Text + " " + TR3.Text;
            }
            else if (comboBox1.SelectedItem == "4")
            {
                TABLE = NR1.Text + " " + TR1.Text + " ," + NR2.Text + " " + TR3.Text + " ," + NR3.Text + " " + TR3.Text + " ," + NR4.Text + " " + TR4.Text;
            }
            else if (comboBox1.SelectedItem == "5")
            {
                TABLE = NR1.Text + " " + TR1.Text + " ," + NR2.Text + " " + TR3.Text + " ," + NR3.Text + " " + TR3.Text + " ," + NR4.Text + " " + TR4.Text + " ," + NR5.Text + " " + TR5.Text;
            }

            try
            {
                conexion.Open();
                string BD = "create table " + TABLA.Text + "(" + TABLE + ")";
                MessageBox.Show(BD);

                MySqlCommand cmd = new MySqlCommand(BD, conexion);

                cmd.ExecuteNonQuery();
                MessageBox.Show("TABLA " + TABLA.Text + " CREADA CORRECTAMENTE");

                conexion.Close();
                NR1.Clear(); TXTCBD.Clear();
                NR2.Clear(); TABLA.Clear();
                NR3.Clear();
                NR4.Clear();
                NR5.Clear();
            }
            catch (Exception ex)
            {
                conexion.Close();
                MessageBox.Show(ex.Message,
                                "ERROR AL CREAR LA TABLA",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        /// <summary>
        /// Creates a Tabla
        /// </summary>
        /// <param name="tablaEntity"></param>
        /// <returns></returns>
        public int CreateTabla(BusinessEntities.TablaEntity tablaEntity)
        {
            using (var scope = new TransactionScope())
            {
                var tabla = new TABLA
                {
                    Descripcion = tablaEntity.Descripcion,
                    IdTabla     = tablaEntity.IdTabla,
                    IdTipoTabla = tablaEntity.IdTipoTabla,
                    TABLA_CAMPO = tablaEntity.TABLA_CAMPO
                };

                _unitOfWork.TablaRepository.Insert(tabla);
                _unitOfWork.Save();
                scope.Complete();
                return(tabla.IdTabla);
            }
        }
示例#5
0
        public JsonResult getConfiguracionPeriodos(string Periodo)
        {
            var query = (from tbl in BDEv.PeriodoObjetivo
                         join tb in BDEv.PERIODO
                         on tbl.ID_Periodo equals tb.ID_Periodo into TABLA
                         from PObj in TABLA.DefaultIfEmpty()
                         where PObj.Descripcion == Periodo
                         select new
            {
                Periodo = tbl.Periodo,
                FechaInicio = PObj.Fecha_Inicio,
                FechaFinal = PObj.Fecha_Final,
                FechaRev = tbl.FechaRevision,
                Habilitar = false,
            }
                         ).ToList();

            return(Json(query));
        }
        protected void imgAgregar_Click(object sender, ImageClickEventArgs e)
        {
            if (Page.IsValid)
            {
                string nombre = ((TextBox)this.grvTabla.FooterRow.FindControl("txtNombre")).Text;
                string descripcion = ((TextBox)this.grvTabla.FooterRow.FindControl("txtDescripcion")).Text;

                TABLA nuevaTabla = new TABLA();
                nuevaTabla.TBL_NOMBRE = nombre;
                nuevaTabla.TBL_DESCRIPCION = descripcion;

                EstadoOperacion Estado = BusinessLayer.Mensajeria.TablaBL.insertarTabla(nuevaTabla);

                if (Estado.Estado)
                {
                    this.grvTabla.DataBind();
                }
                else
                {
                    this.lblMensaje.Text = Estado.Mensaje;
                }
            }
        }
示例#7
0
        protected void btnbuscar_Click(object sender, EventArgs e)
        {
            string buscarced;

            buscarced = txtcedula.Text;

            string        cadena = @"Data Source=(LocalDb)\v11.0;AttachDbFilename=c:\users\lab104bpc13\documents\visual studio 2012\Projects\Webparcial\Webparcial\App_Data\aspnet-Webparcial-20150424191146.mdf;Initial Catalog=aspnet-Webparcial-20150424191146;Integrated Security=True";
            SqlConnection cn     = new SqlConnection(cadena);


            string consulta = "SELECT * FROM empleados where cedula='" + buscarced + "'";

            SqlDataAdapter da        = new SqlDataAdapter(consulta, cn);
            DataTable      datatable = new DataTable();

            cn.Open();

            int recordsAffected = da.Fill(datatable);

            TABLA.DataSource = datatable;
            TABLA.DataBind();
            cn.Close();
        }
示例#8
0
        private static DbCommand crearComando(Switch contexto, TABLA tabla, string query)
        {
            DbFactory Factoria = DataAccessFactory.ObtenerProveedor();

            DbCommand Comando = contexto.CreateCommand(query, CommandType.StoredProcedure);

            Comando.Parameters.Add(Factoria.CrearParametro("@codigo", tabla.TBL_CODIGO));
            Comando.Parameters.Add(Factoria.CrearParametro("@nombre", tabla.TBL_NOMBRE));
            Comando.Parameters.Add(Factoria.CrearParametro("@descripcion", tabla.TBL_DESCRIPCION));

            return Comando;
        }
示例#9
0
        public static EstadoOperacion modificarTabla(TABLA tabla)
        {
            try
            {
                using (Switch contexto = new Switch())
                {
                    using (contexto.CreateConeccionScope())
                    {
                        string query = "ModificarTabla";

                        DbCommand Comando = crearComando(contexto, tabla, query);

                        if (Comando.ExecuteNonQuery() != 1)
                        {
                            return new EstadoOperacion(false, null, null);
                        }

                        return new EstadoOperacion(true, null, null);
                    }
                }
            }
            catch (DbException ex)
            {
                return new EstadoOperacion(false, ex.Message, ex, false);
            }
            catch (Exception e)
            {

                return new EstadoOperacion(false, e.Message, e);
            }
        }
        protected void imgAgregar_Click(object sender, ImageClickEventArgs e)
        {
            COLUMNA columna = new COLUMNA()
            {
                COL_NOMBRE = ((TextBox)this.grvColumna.FooterRow.FindControl("txtNombreFooter")).Text,
                COL_LONGITUD = int.Parse(((TextBox)this.grvColumna.FooterRow.FindControl("txtLongitudFooter")).Text)
            };

            TABLA tabla = new TABLA()
            {
                TBL_CODIGO = int.Parse(((HiddenField)this.frmTabla.FindControl("hdnCodigo")).Value)
            };
            columna.TABLA = tabla;

            TIPO_DATO_COLUMNA tipoDato = new TIPO_DATO_COLUMNA()
            {
                TDC_CODIGO = int.Parse(((DropDownList)this.grvColumna.FooterRow.FindControl("drlTipoFooter")).SelectedValue)
            };
            columna.TIPO_DATO_COLUMNA = tipoDato;

            EstadoOperacion Estado = BusinessLayer.Mensajeria.ColumnaBL.insertarColumna(columna);

            if (Estado.Estado)
            {
                this.grvColumna.DataBind();
            }
            else
            {
                this.lblMensaje.Text = Estado.Mensaje;
            }
        }
示例#11
0
 public static EstadoOperacion modificarTabla(TABLA tabla)
 {
     return DataAccess.Mensajeria.TablaDA.modificarTabla(tabla);
 }
示例#12
0
 public static EstadoOperacion insertarTabla(TABLA tabla)
 {
     return DataAccess.Mensajeria.TablaDA.insertarTabla(tabla);
 }
示例#13
0
 public static EstadoOperacion eliminarTabla(TABLA tabla)
 {
     return DataAccess.Mensajeria.TablaDA.eliminarTabla(tabla);
 }