Esempio n. 1
0
        private void btn_guardar_contrase_Click(object sender, EventArgs e)
        {
            cls_Combustible_BLL obj_Combustible_BLL = new cls_Combustible_BLL();

            obj_Combustible_DAL.sDescripcion = txt_descrip.Text;
            string tempo = cbx_estado.SelectedItem.ToString();

            if (tempo == "Activo")
            {
                obj_Combustible_DAL.cEstado = '1';
            }
            else
            {
                obj_Combustible_DAL.cEstado = '0';
            }
            obj_Combustible_DAL.iCod_EmpleCreador = 1; //Esta quemado porque no puedo validar aún el usuario
            obj_Combustible_DAL.FechaCreado       = DateTime.Today;
            obj_Combustible_BLL.Insert_Combustible(ref obj_Combustible_DAL);
            if (obj_Combustible_DAL.sMgsError == string.Empty)
            {
                obj_Combustible_DAL.cBanOpc = 'U';
                MessageBox.Show("Creación de combustible Exitoso", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                obj_Combustible_DAL.cBanOpc = 'I';
                MessageBox.Show("Creación de combustible Fallida \n\n Error:[ " + obj_Combustible_DAL.sMgsError + " ]", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }


            this.Dispose();
        }
        public void CargarCombo()
        {
            #region Objetos DAL
            cls_Marcas_DAL         Obj_Marcas_DAL   = new cls_Marcas_DAL();
            cls_TiposVehiculos_DAL Obj_TipoVehi_DAL = new cls_TiposVehiculos_DAL();
            cls_ModelosVehi_DAL    Obj_Modelos_DAL  = new cls_ModelosVehi_DAL();
            cls_Combustible_DAL    Obj_Combus_DAL   = new cls_Combustible_DAL();
            #endregion
            #region Objetos BLL
            cls_Marcas_BLL         Obj_Marcacs_BLL = new cls_Marcas_BLL();
            cls_ModelosVehi_BLL    Obj_Modelos_BLL = new cls_ModelosVehi_BLL();
            cls_TiposVehiculos_BLL Obj_Tipos_BLL   = new cls_TiposVehiculos_BLL();

            cls_Combustible_BLL Obj_Combus_BLL = new cls_Combustible_BLL();

            #endregion
            Obj_Marcacs_BLL.List_Marcas(ref Obj_Marcas_DAL);
            cmb_Marca.DataSource    = Obj_Marcas_DAL.dData.Tables[ConfigurationManager.AppSettings["tablamarcavehiculos"].ToString()].DefaultView;
            cmb_Marca.DisplayMember = Obj_Marcas_DAL.dData.Tables[0].Columns["Marca"].ToString();
            cmb_Marca.ValueMember   = "Id";//Marca

            Obj_Modelos_BLL.List_ModelosVehi(ref Obj_Modelos_DAL);
            cmb_Modelo.DataSource    = Obj_Modelos_DAL.dData.Tables[ConfigurationManager.AppSettings["tablamodelosvehiculos"].ToString()].DefaultView;
            cmb_Modelo.DisplayMember = Obj_Modelos_DAL.dData.Tables[0].Columns["Modelo"].ToString();
            cmb_Modelo.ValueMember   = "Id";//Modelo

            Obj_Tipos_BLL.List_TiposVehiculos(ref Obj_TipoVehi_DAL);
            cbx_tipos.DataSource    = Obj_TipoVehi_DAL.dData.Tables[ConfigurationManager.AppSettings["tablatiposvehiculos"].ToString()].DefaultView;
            cbx_tipos.DisplayMember = Obj_TipoVehi_DAL.dData.Tables[ConfigurationManager.AppSettings["tablatiposvehiculos"].ToString()].Columns["Nombre"].ToString();
            cbx_tipos.ValueMember   = "Id";//Tipos

            Obj_Combus_BLL.List_Combustible(ref Obj_Combus_DAL);
            cbx_combus.DataSource    = Obj_Combus_DAL.dData.Tables[ConfigurationManager.AppSettings["tablacombustibles"].ToString()].DefaultView;
            cbx_combus.DisplayMember = Obj_Combus_DAL.dData.Tables[0].Columns["Descripcion"].ToString();
            cbx_combus.ValueMember   = "Id";// Combustibles
        }