Exemplo n.º 1
0
        protected void btnUpdateTypeUser_Click(object sender, EventArgs e)
        {
            Class.TypUser typuser = new TypUser();
            typuser.ID_Typ             = Convert.ToInt32(hddIdTypeUser.Value);
            typuser.DescriptionTypUser = UpdateTypeUserText.Text;
            Result res = DataAccess.DataAccessUser.UpdateTypeUser(typuser);

            BindGridTypeUser();


            if (res.result)
            {
                DivSuccessConfig.Visible = true;
                DivErrorConfig.Visible   = false;
                fUpdateTypeUser.Visible  = false;
            }
            else
            {
                DivSuccessConfig.Visible = false;
                DivErrorConfig.Visible   = true;
                lblErrorConfig.Text      = res.Message;
            }
            fAddUserType.Visible    = true;
            fUpdateTypeUser.Visible = false;
            UpdateTypeUserText.Text = "";
        }
Exemplo n.º 2
0
        public static Result InsertTypeUser(TypUser tu)
        {
            Result res = new Result();

            //try
            //{
            using (MySqlConnection conn = DataAccessBase.GetConnection())
            {
                conn.Open();
                MySqlCommand command = new MySqlCommand("InsertTypeUser", conn);
                command.CommandType = System.Data.CommandType.StoredProcedure;

                command.Parameters.AddWithValue("DescriptionType", tu.DescriptionTypUser);

                command.ExecuteNonQuery();


                res.result = true;
            }
            //}
            //catch (Exception ex)
            //{
            //    esito.result = false;
            //    esito.Message= ex.Message;
            //}

            return(res);
        }
Exemplo n.º 3
0
        // new type user, eventargs-> nuovo evento se clicco su button
        protected void btnAddTypeUser_Click(object sender, EventArgs e)
        {
            // variabile tu della classe TypUser
            TypUser tu = new TypUser();

            tu.DescriptionTypUser = txtDescriptionType.Text;
            DataAccess.DataAccessUser.InsertTypeUser(tu); // id non lo inserisco perche è autoincrementante

            BindGridTypeUser();                           // refresh gridview
            txtDescriptionType.Text = string.Empty;       // textbox empty
        }
Exemplo n.º 4
0
        public static Result UpdateTypeUser(TypUser tu)
        {
            Result res = new Result();

            using (MySqlConnection conn = DataAccessBase.GetConnection())
            {
                conn.Open();
                MySqlCommand command = new MySqlCommand("UpdateTypeUser", conn);
                command.CommandType = System.Data.CommandType.StoredProcedure;

                command.Parameters.AddWithValue("idtypeuser", tu.ID_Typ);
                command.Parameters.AddWithValue("TypeUser", tu.DescriptionTypUser);

                command.ExecuteNonQuery();


                res.result = true;
            }

            return(res);
        }