Example #1
0
        ////// PERSISTENCIA /////////
        public void persistir(Rol unRol)
        {
            DataAccess.SPManager spManager = new DataAccess.SPManager();

            Dictionary <String, Object> param = new Dictionary <string, object>();

            param.Add("nombre_rol", unRol.getNombreRol());

            SqlTransaction tran = spManager.DbManager.Connection.BeginTransaction();

            try
            {
                spManager.executeSPWithParametersWithOutReturn("MR_ANDERSON.sp_new_rol", param, tran);
                param.Add("tipo", unRol.TipoUsuario);
                spManager.executeSPWithParametersWithOutReturn("MR_ANDERSON.sp_new_rol_tipo", param, tran);
            }
            catch (Exception e)
            {
                tran.Rollback();
                spManager.Close();
                throw new Exception("No se pudo dar de alta al rol. Motivo: " + e.ToString());
            }

            tran.Commit();
            spManager.Close();

            Dictionary <String, Object> param_funcs = new Dictionary <string, object>();

            foreach (String func in unRol.getFuncionalidades())
            {
                this.addFuncionalidad(unRol.getNombreRol(), func);
            }
        }
Example #2
0
        private Menu crearMenuWindow(Rol.Rol unRol)
        {
            Menu menu = new Menu(this);
            int  i    = 0;
            int  j    = 0;

            foreach (String func in unRol.getFuncionalidades())
            {
                Button boton = new Button();
                boton.Text     = func;
                boton.AutoSize = true;
                boton.Location = new System.Drawing.Point(20 + j, 20 + i);
                boton.Click   += new EventHandler(this.buttonClicked);
                menu.Controls.Add(boton);
                i = i + 35;
                if (i > 35 * 6)
                {
                    i = 0;
                    j = j + 110;
                }
            }
            this.menu = menu;
            return(menu);
        }
Example #3
0
        ////// PERSISTENCIA /////////
        public void persistir(Rol unRol)
        {
            DataAccess.SPManager spManager = new DataAccess.SPManager();

            Dictionary<String, Object> param = new Dictionary<string, object>();
            param.Add("nombre_rol", unRol.getNombreRol());

            SqlTransaction tran = spManager.DbManager.Connection.BeginTransaction();

            try
            {

                spManager.executeSPWithParametersWithOutReturn("MR_ANDERSON.sp_new_rol", param,tran);
                param.Add("tipo", unRol.TipoUsuario);
                spManager.executeSPWithParametersWithOutReturn("MR_ANDERSON.sp_new_rol_tipo", param,tran);
            }
            catch (Exception e)
            {
                tran.Rollback();
                spManager.Close();
                throw new Exception("No se pudo dar de alta al rol. Motivo: " + e.ToString());
            }

            tran.Commit();
            spManager.Close();

            Dictionary<String, Object> param_funcs = new Dictionary<string, object>();

            foreach (String func in unRol.getFuncionalidades())
            {

                this.addFuncionalidad(unRol.getNombreRol(), func);
            }
        }