Esempio n. 1
0
        private void btn_guardar_Click(object sender, EventArgs e)
        {
            cls_Marcas_BLL obj_Marcas_BLL = new cls_Marcas_BLL();

            obj_Marcas_DAL.sDescripcion = txt_descripcion.Text;
            obj_Marcas_DAL.bEstado      = Convert.ToBoolean(cbx_estado.Text);
            obj_Marcas_DAL.Id_TiposVehi = 2; //Aquí va el cmbox de tipo de vehículo    Convert.ToInt32(cmb_Tipo.SelectedValue.ToString());
            obj_Marcas_DAL.iCod_Emple   = 1; //Se jala automatico
            obj_Marcas_DAL.FechaCreado  = DateTime.Today;
            obj_Marcas_BLL.Insert_Marcas(ref obj_Marcas_DAL);
            if (obj_Marcas_DAL.sMgsError == string.Empty)
            {
                obj_Marcas_DAL.cBanOpc = 'U';
                MessageBox.Show("Creación de marca Exitoso", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                obj_Marcas_DAL.cBanOpc = 'I';
                MessageBox.Show("Creación de marca Fallida \n\n Error:[ " + obj_Marcas_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
        }