Exemple #1
0
        public DataTable GetList(
            string nombre,
            Constants.Embajadas idEmbajada,
            bool showAllEmbajadas,
            bool activo,
            bool showAllActivo)
        {
            DataTable dtEstructure = TipoVisaDao.DtEstructure;

            try
            {
                DbConnection connection = this.instance.CreateConnection();
                try
                {
                    connection.Open();
                    DbCommand storedProcCommand = this.instance.GetStoredProcCommand("PA_TIPO_VISA_GET_LIST");
                    storedProcCommand.Connection = connection;
                    if (nombre != string.Empty)
                    {
                        this.instance.AddInParameter(storedProcCommand, "@NOMBRE", DbType.String, (object)nombre);
                    }
                    else
                    {
                        this.instance.AddInParameter(storedProcCommand, "@NOMBRE", DbType.String, (object)DBNull.Value);
                    }
                    if (!showAllEmbajadas)
                    {
                        this.instance.AddInParameter(storedProcCommand, "@ID_EMBAJADA", DbType.Int32, (object)Convert.ToInt32((object)idEmbajada));
                    }
                    else
                    {
                        this.instance.AddInParameter(storedProcCommand, "@ID_EMBAJADA", DbType.Int32, (object)DBNull.Value);
                    }
                    if (!showAllActivo)
                    {
                        this.instance.AddInParameter(storedProcCommand, "@ACTIVO", DbType.Boolean, (object)activo);
                    }
                    else
                    {
                        this.instance.AddInParameter(storedProcCommand, "@ACTIVO", DbType.Boolean, (object)DBNull.Value);
                    }
                    DbDataAdapter dataAdapter = this.instance.GetDataAdapter();
                    dataAdapter.SelectCommand = storedProcCommand;
                    dataAdapter.Fill(dtEstructure);
                }
                catch (Exception ex)
                {
                    this.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                }
                finally
                {
                    connection.Close();
                }
            }
            catch (Exception ex)
            {
                this.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
            }
            return(dtEstructure);
        }
        public DataTable GetList(
            string nombre,
            Constants.Embajadas idEmbajada,
            bool showAllEmbajadas,
            bool activo,
            bool showAllActivo)
        {
            TipoVisaDao tipoVisaDao = new TipoVisaDao();
            DataTable   list        = tipoVisaDao.GetList(nombre, idEmbajada, showAllEmbajadas, activo, showAllActivo);

            this.error = tipoVisaDao.Error;
            return(list);
        }
        public List <TipoVisa> GetTipoVisas(
            string nombre,
            Constants.Embajadas idEmbajada,
            bool showAllEmbajadas,
            bool activo,
            bool showAllActivo)
        {
            TipoVisaDao     tipoVisaDao = new TipoVisaDao();
            List <TipoVisa> tipoVisas   = tipoVisaDao.GetTipoVisas(nombre, idEmbajada, showAllEmbajadas, activo, showAllActivo);

            this.error = tipoVisaDao.Error;
            return(tipoVisas);
        }
Exemple #4
0
        private void SaveInfo(bool isCreate, GridCommandEventArgs e)
        {
            //Capturar la fila que se va a editar

            GridEditableItem editColumn = (GridEditableItem)e.Item;
            Hashtable        newValues  = new Hashtable();

            e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editColumn);

            string nombre = newValues["NOMBRE"].ToString();

            Constants.Embajadas idEmbaj = (Constants.Embajadas)Convert.ToInt32(newValues["ID_EMBAJADA"]);
            bool activoObj = Convert.ToBoolean(newValues["ACTIVO"]);

            TipoVisaBll objBllSave = new TipoVisaBll();
            TipoVisa    objEntity  = new TipoVisa();

            if (isCreate)
            {
                objEntity.IdCreacion    = this.IdUserCurrent;
                objEntity.FechaCreacion = DateTime.Now;
            }
            else
            {
                int idToUpdate = Convert.ToInt32(e.Item.OwnerTableView.DataKeyValues[editColumn.ItemIndex]["ID"]);
                objEntity.Id = idToUpdate;
            }

            objEntity.Nombre                  = nombre;
            objEntity.IdEmbajada              = idEmbaj;
            objEntity.Activo                  = activoObj;
            objEntity.IdUltimaModificacion    = this.IdUserCurrent;
            objEntity.FechaUltimaModificacion = DateTime.Now;

            if (!objBllSave.Save(objEntity))
            {
                this.gvTipoVisa.EditIndexes.Clear();
                this.gvTipoVisa.Rebind();
                erroresCarga.Text = objBllSave.Error;
            }
            else
            {
                this.gvTipoVisa.EditIndexes.Clear();
                this.gvTipoVisa.Rebind();
            }
        }
Exemple #5
0
        public List <TipoVisa> GetTipoVisas(
            string nombre,
            Constants.Embajadas idEmbajada,
            bool showAllEmbajada,
            bool activo,
            bool showAllActivo)
        {
            List <TipoVisa> tipoVisaList = new List <TipoVisa>();

            try
            {
                foreach (DataRow row in (InternalDataCollectionBase)this.GetList(nombre, idEmbajada, showAllEmbajada, activo, showAllActivo).Rows)
                {
                    TipoVisa objToLoad = new TipoVisa();
                    this.LoadFromDataRow(ref objToLoad, row);
                    tipoVisaList.Add(objToLoad);
                }
            }
            catch (Exception ex)
            {
                this.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
            }
            return(tipoVisaList);
        }