Exemplo n.º 1
0
        protected void DoAddSubmitUser()
        {
            AppUser u = new AppUser();

            // validate data
            u._username  = Request["username"];
            u._passwd    = Request["passwd"];
            u._firstname = Request["firstname"];
            u._surname   = Request["surname"];
            u._roleId    = Int32.Parse(Request["role_id"]);
            u._branchID  = Int32.Parse(Request["branch_id"]);

            // Save to DB
            DBManager db = new MySQLDBManager(Config.DB_SERVER, Config.DB_NAME, Config.DB_USER, Config.DB_PASSWORD, Config.DB_CHAR_ENC);

            db.Connect();
            try
            {
                u.AddToDB(db);
            }
            catch (Exception e)
            {
                // show message?
            }
            db.Close();
        }